<template>
  <transition name="yh-setting-fade">
    <div class="setting" :class="{ settingShow: settingShow }" v-show="settingShow">
      <div class="setting_dislog" @click="settingClose"></div>
      <div class="setting_inner">
        <div class="setting_header">
          <!--??? <el-input
            class="input-new-tag"
            v-if="inputVisible"
            v-model="inputValue"
            ref="saveTagInput"
            @keyup.enter.native="handleInputConfirm"
            @blur="handleInputConfirm"
            placeholder="输入名称"
          ></el-input>
          <el-button v-else class="button-new-tag" @click="showInput">
            <i class="el-icon-plus"></i> New
          </el-button>
          <el-button class="button-new-tag" @click="delRecord">
            <i class="el-icon-minus"></i> Delete
          </el-button>
          <el-select
            v-model="history"
            v-on:change="loadRecord"
            placeholder="RECORDS"
            class="input-new-tag"
          >
            <el-option v-for="item in histories" :key="item" :label="item" :value="item"></el-option>
          </el-select>-->
          <el-upload action="load" accept=".json" :before-upload="loadFile" :show-file-list="false">
            <el-button class="button-new-tag" slot="trigger">
              <i class="el-icon-receiving"></i> Load
            </el-button>
            <el-button class="button-new-tag" @click="saveFile">
              <i class="el-icon-download"></i> Save
            </el-button>
            <el-button class="button-new-tag" @click="updateLastSEIAS">
              <i class="el-icon-refresh"></i> Update
            </el-button>
          </el-upload>
        </div>

        <el-tabs type="border-card" tab-position="top">
          <!-- Basic info -->
          <el-tab-pane>
            <span slot="label">
              <i class="el-icon-ship"></i> Basic info
            </span>
            <div class="setting_body">
              <el-collapse accordion>
                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Basic info for the vessel</div>
                  </template>

                  <div class="setting_item">
                    <span class="setting_label">Project objective :</span>
                    <div class="setting_content">
                      <el-radio-group v-model="radioModel.isNewbuilding">
                        <el-radio :label="true">Newbuilding</el-radio>
                        <el-radio :label="false">Retrofittings</el-radio>
                      </el-radio-group>
                    </div>
                  </div>

                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Ship Type :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select
                            v-model="selectModel.shipType"
                            placeholder="SHIP TYPE"
                            size="mini"
                          >
                            <el-option
                              v-for="item in selectOptions.shipType"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Ice Class :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select
                            v-model="selectModel.iceClass"
                            placeholder="Ice Class"
                            size="mini"
                          >
                            <el-option
                              v-for="item in selectOptions.iceClass"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>

                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(vesselModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ vesselLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="vesselLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="vesselLable[item]"
                              size="mini"
                              v-model="vesselModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>

                  <div class="setting_item">
                    <span class="setting_label">HCSR?</span>
                    <div class="setting_content">
                      <el-radio-group v-model="radioModel.isHCSR">
                        <el-radio :label="true">YES</el-radio>
                        <el-radio :label="false">NO</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Basic info for EEDI</div>
                  </template>
                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(eediModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ eediLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="eediLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="eediLable[item]"
                              size="mini"
                              v-model="eediModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>

                <el-collapse-item v-show="radioModel.isNewbuilding">
                  <template slot="title">
                    <div class="left_shu">Basic info for CII</div>
                  </template>
                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(ciiModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ ciiLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="ciiLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="ciiLable[item]"
                              size="mini"
                              v-model="ciiModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>

                <el-collapse-item v-show="!radioModel.isNewbuilding">
                  <template slot="title">
                    <div class="left_shu">Basic info for EEXI</div>
                  </template>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Basic info for FuelEU</div>
                  </template>
                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(fuelEUModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ fuelEULable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="fuelEULable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="fuelEULable[item]"
                              size="mini"
                              v-model="fuelEUModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Basic info for Economic</div>
                  </template>
                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(economicModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ economicLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="economicLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="economicLable[item]"
                              size="mini"
                              v-model="economicModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>

                  <div class="setting_item">
                    <span class="setting_label">Business mode :</span>
                    <div class="setting_content">
                      <el-radio-group v-model="radioModel.isChartering">
                        <el-radio :label="true">Chartering mode</el-radio>
                        <el-radio :label="false">Self-operating mode</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                  <div class="setting_item">
                    <span class="setting_label">Loan repay method :</span>
                    <div class="setting_content">
                      <el-radio-group v-model="radioModel.isEqualPrincipalPayment">
                        <el-radio :label="true">Equal Principal Payment</el-radio>
                        <el-radio :label="false">Equal Principal and Interest</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </el-collapse-item>

                <el-collapse-item v-show="radioModel.isChartering">
                  <template slot="title">
                    <div class="left_shu">Basic info for Chartering mode</div>
                  </template>
                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(charteringModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ charteringLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="charteringLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="charteringLable[item]"
                              size="mini"
                              v-model="charteringModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>

                <el-collapse-item v-show="!radioModel.isChartering">
                  <template slot="title">
                    <div class="left_shu">Basic info for Self-operating mode</div>
                  </template>
                  <div class="setting_item">
                    <el-row
                      :gutter="20"
                      v-for="item in Object.keys(selfOperatingModel)"
                      :key="item"
                    >
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ selfOperatingLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="selfOperatingLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="selfOperatingLable[item]"
                              size="mini"
                              v-model="selfOperatingModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>
              </el-collapse>
            </div>
          </el-tab-pane>

          <!-- Decarbon -->
          <el-tab-pane>
            <span slot="label">
              <i class="el-icon-odometer"></i> Decarbon
            </span>
            <div class="setting_body">
              <el-collapse accordion>
                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Basic Information</div>
                  </template>

                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(targetModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ targetLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="targetLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="targetLable[item]"
                              size="mini"
                              v-model="targetModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>

                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">CII Rating target :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select v-model="selectModel.ciiRating" size="mini">
                            <el-option
                              v-for="item in selectOptions.ciiRating"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>

                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">CII Operating limit year:</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select v-model="selectModel.ciiLimitYear" size="mini">
                            <el-option
                              v-for="item in selectOptions.deliveryYear"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Delivery year(Start of operation):</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select v-model="selectModel.deliveryYear" size="mini">
                            <el-option
                              v-for="item in selectOptions.deliveryYear"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Fuel Mode:</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select v-model="selectModel.fuelMode" size="mini">
                            <el-option
                              v-for="item in selectOptions.fuelMode"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>

                  <div class="setting_item">
                    <span class="setting_label">FueEU :</span>
                    <div class="setting_content">
                      <el-radio-group v-model="radioModel.isFueEU">
                        <el-radio :label="true">YES</el-radio>
                        <el-radio :label="false">NO</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                  <div class="setting_item">
                    <span class="setting_label">EU ETS :</span>
                    <div class="setting_content">
                      <el-radio-group v-model="radioModel.isEUETS">
                        <el-radio :label="true">YES</el-radio>
                        <el-radio :label="false">NO</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                  <div class="setting_item">
                    <span class="setting_label">Other Carbon Price :</span>
                    <div class="setting_content">
                      <el-radio-group v-model="radioModel.isOtherCarbonPrice">
                        <el-radio :label="true">YES</el-radio>
                        <el-radio :label="false">NO</el-radio>
                      </el-radio-group>
                    </div>
                  </div>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Fuel Info</div>
                  </template>

                  <div class="setting_item">
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="newInputFuel(fuelInfoModel.fcMELaden,true)"
                    >M/E Fuel Consumption @ laden New</el-button>

                    <div>
                      <el-tag :disable-transitions="false">
                        #:
                        <el-input
                          size="mini"
                          style="width: 25%;"
                          :disabled="true"
                          placeholder="Speed"
                        ></el-input>;
                        <el-input
                          size="mini"
                          :placeholder="targetModel.speedLaden+' kn'"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>
                        <el-input
                          size="mini"
                          placeholder="-1 kn"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>
                        <el-input
                          size="mini"
                          placeholder="-2 kn"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>
                        <el-input
                          size="mini"
                          placeholder="-3 kn"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>;
                      </el-tag>
                    </div>

                    <div>
                      <el-tag
                        v-for="(tag, index) in fuelInfoModel.fcMELaden"
                        :key="index"
                        :disable-transitions="false"
                        closable
                        @close="handleDelete(fuelInfoModel.fcMELaden,index)"
                      >
                        {{index}}:
                        <el-select v-model="tag.fuelType" size="mini" style="width: 25%;">
                          <el-option
                            v-for="(item, index) in selectOptions.fuelType"
                            :key="index"
                            :label="item"
                            :value="item"
                          ></el-option>
                        </el-select>;
                        <el-input
                          v-for="(c, i) in tag.fc"
                          :key="i"
                          v-model="tag.fc[i]"
                          size="mini"
                          placeholder="fc"
                          style="width: 15%;"
                        ></el-input>;
                      </el-tag>
                    </div>
                  </div>

                  <div class="setting_item">
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="newInputFuel(fuelInfoModel.fcMEBallast,true)"
                    >M/E Fuel Consumption @ ballast New</el-button>

                    <div>
                      <el-tag :disable-transitions="false">
                        #:
                        <el-input
                          size="mini"
                          style="width: 25%;"
                          :disabled="true"
                          placeholder="Speed"
                        ></el-input>;
                        <el-input
                          size="mini"
                          :placeholder="targetModel.speedBallast+' kn'"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>
                        <el-input
                          size="mini"
                          placeholder="-1 kn"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>
                        <el-input
                          size="mini"
                          placeholder="-2 kn"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>
                        <el-input
                          size="mini"
                          placeholder="-3 kn"
                          style="width: 15%;"
                          :disabled="true"
                        ></el-input>;
                      </el-tag>
                    </div>

                    <div>
                      <el-tag
                        v-for="(tag, index) in fuelInfoModel.fcMEBallast"
                        :key="index"
                        :disable-transitions="false"
                        closable
                        @close="handleDelete(fuelInfoModel.fcMEBallast,index)"
                      >
                        {{index}}:
                        <el-select v-model="tag.fuelType" size="mini" style="width: 25%;">
                          <el-option
                            v-for="(item, index) in selectOptions.fuelType"
                            :key="index"
                            :label="item"
                            :value="item"
                          ></el-option>
                        </el-select>;
                        <el-input
                          v-for="(c, i) in tag.fc"
                          :key="i"
                          v-model="tag.fc[i]"
                          size="mini"
                          placeholder="fc"
                          style="width: 15%;"
                        ></el-input>;
                      </el-tag>
                    </div>
                  </div>

                  <div class="setting_item">
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="newInputFuel(fuelInfoModel.fcAEVoyage,false)"
                    >A/E Fuel Consumption @ voyage New</el-button>
                    <div>
                      <el-tag
                        v-for="(tag, index) in fuelInfoModel.fcAEVoyage"
                        :key="index"
                        :disable-transitions="false"
                        closable
                        @close="handleDelete(fuelInfoModel.fcAEVoyage,index)"
                      >
                        {{index}}:
                        <el-select v-model="tag.fuelType" size="mini" style="width: 25%;">
                          <el-option
                            v-for="(item, index) in selectOptions.fuelType"
                            :key="index"
                            :label="item"
                            :value="item"
                          ></el-option>
                        </el-select>;
                        <el-input v-model="tag.fc" size="mini" placeholder="fc" style="width: 15%;"></el-input>;
                      </el-tag>
                    </div>
                  </div>

                  <div class="setting_item">
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="newInputFuel(fuelInfoModel.fcAEBerth,false)"
                    >A/E Fuel Consumption @ berth New</el-button>
                    <div>
                      <el-tag
                        v-for="(tag, index) in fuelInfoModel.fcAEBerth"
                        :key="index"
                        :disable-transitions="false"
                        closable
                        @close="handleDelete(fuelInfoModel.fcAEBerth,index)"
                      >
                        {{index}}:
                        <el-select v-model="tag.fuelType" size="mini" style="width: 25%;">
                          <el-option
                            v-for="(item, index) in selectOptions.fuelType"
                            :key="index"
                            :label="item"
                            :value="item"
                          ></el-option>
                        </el-select>;
                        <el-input v-model="tag.fc" size="mini" placeholder="fc" style="width: 15%;"></el-input>;
                      </el-tag>
                    </div>
                  </div>

                  <div class="setting_item">
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="newInputFuel(fuelInfoModel.fcAECargo,false)"
                    >A/E Fuel Consumption @ cargo New</el-button>
                    <div>
                      <el-tag
                        v-for="(tag, index) in fuelInfoModel.fcAECargo"
                        :key="index"
                        :disable-transitions="false"
                        closable
                        @close="handleDelete(fuelInfoModel.fcAECargo,index)"
                      >
                        {{index}}:
                        <el-select v-model="tag.fuelType" size="mini" style="width: 25%;">
                          <el-option
                            v-for="(item, index) in selectOptions.fuelType"
                            :key="index"
                            :label="item"
                            :value="item"
                          ></el-option>
                        </el-select>;
                        <el-input v-model="tag.fc" size="mini" placeholder="fc" style="width: 15%;"></el-input>;
                      </el-tag>
                    </div>
                  </div>
                  <div class="setting_item">
                    <el-button size="mini" style="margin: 5px">Pilot oil Consumption</el-button>
                    <div>
                      <el-tag
                        v-for="(tag, index) in fuelInfoModel.fcPilot"
                        :key="index"
                        :disable-transitions="false"
                      >
                        {{index}}:
                        <el-select v-model="tag.fuelType" size="mini" style="width: 25%;">
                          <el-option
                            v-for="(item, index) in selectOptions.fuelType"
                            :key="index"
                            :label="item"
                            :value="item"
                          ></el-option>
                        </el-select>;
                        <el-input v-model="tag.fc" size="mini" placeholder="fc" style="width: 15%;"></el-input>;
                      </el-tag>
                    </div>
                  </div>
                  <!-- {{fuelInfoModel}} -->
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">SFC @ laden @75%MCR</div>
                  </template>

                  <div class="setting_item">
                    <el-row :gutter="20" v-for="item in Object.keys(sfcModel)" :key="item">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">{{ sfcLable[item] }} :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            :content="sfcLable[item]"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              :placeholder="sfcLable[item]"
                              size="mini"
                              v-model="sfcModel[item]"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Design for fuel tanks</div>
                  </template>

                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Fuel 1 tank type :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select v-model="selectModel.fuel1TankType" size="mini">
                            <el-option
                              v-for="item in selectOptions.fuelTankType"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Fuel type 1 tank net Capacity (m3) :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            content="Fuel type 1 tank net Capacity (m3)"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              placeholder="Fuel type 1 tank net Capacity (m3)"
                              size="mini"
                              v-model="fuelTanksModel.fuel1TypeCapacity"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Fuel 2 tank type :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select v-model="selectModel.fuel2TankType" size="mini">
                            <el-option
                              v-for="item in selectOptions.fuelTankType"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Fuel type 2 tank net Capacity (m3) :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            content="Fuel type 2 tank net Capacity (m3)"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              placeholder="Fuel type 2 tank net Capacity (m3)"
                              size="mini"
                              v-model="fuelTanksModel.fuel2TypeCapacity"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Fuel 3 tank type :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-select v-model="selectModel.fuel3TankType" size="mini">
                            <el-option
                              v-for="item in selectOptions.fuelTankType"
                              :key="item"
                              :label="item"
                              :value="item"
                            ></el-option>
                          </el-select>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Fuel type 3 tank net Capacity (m3) :</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            content="Fuel type 3 tank net Capacity (m3)"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              placeholder="Fuel type 3 tank net Capacity (m3)"
                              size="mini"
                              v-model="fuelTanksModel.fuel3TypeCapacity"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Pwind（feff*Peff）</div>
                  </template>

                  <div class="setting_item">
                    <el-row :gutter="20">
                      <el-col :span="16">
                        <div class="grid-content bg-purple">
                          <span class="setting_label">Pwind（feff*Peff） (kW):</span>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-tooltip
                            content="Pwind（feff*Peff） (kW)"
                            placement="right-start"
                            effect="light"
                          >
                            <el-input
                              placeholder="Pwind（feff*Peff） (kW)"
                              size="mini"
                              v-model="technicalModel.pWind"
                            ></el-input>
                          </el-tooltip>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Decarbon Solutions</div>
                  </template>
                  <div class="setting_item">
                    Fuel Solution
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="fuelSoluTableVisible=true"
                    >Edit</el-button>

                    <el-dialog
                      title="Fuel Solution Table"
                      :visible.sync="fuelSoluTableVisible"
                      width="100%"
                      append-to-body
                      center
                    >
                      <div>
                        <!-- {{decarbonModel.fuelSolu}} -->
                        <div>
                          <el-switch
                            v-model="autoFill"
                            active-text="自动填充"
                            active-color="#13ce66"
                            style="margin:5px"
                          ></el-switch>
                          <el-button
                            size="mini"
                            style="margin: 5px"
                            @click="resetFuelSoluTable"
                          >Reset</el-button>
                        </div>

                        <el-tag :disable-transitions="false">
                          <el-col :span="1">Year:</el-col>
                          <span>
                            <el-input
                              v-for="(item, i) in selectOptions.deliveryYear"
                              :key="i"
                              :disabled="true"
                              v-model="selectOptions.deliveryYear[i]"
                              size="mini"
                              style="width: 3.5%;"
                            ></el-input>
                          </span>
                        </el-tag>

                        <el-tag
                          v-for="(valueArr,keyFuel,index) in decarbonModel.fuelSolu"
                          :key="index"
                          :disable-transitions="false"
                        >
                          <el-col :span="1">{{keyFuel}}:</el-col>
                          <span v-if="keyFuel.includes('cost') || keyFuel.includes('Ratio')">
                            <el-input
                              v-for="(item, i) in valueArr"
                              :key="i"
                              v-model="valueArr[i]"
                              size="mini"
                              style="width: 3.5%;"
                              @input="autoFill?setSolu(valueArr,i):()=>{}"
                            ></el-input>
                          </span>
                          <span v-else>
                            <el-select
                              v-for="(item, j) in valueArr"
                              :key="j"
                              v-model="valueArr[j]"
                              size="mini"
                              style="width: 3.5%;"
                              @change="autoFill?setSolu(valueArr,j):()=>{}"
                            >
                              <el-option
                                v-for="(fuelType, indexFuel) in selectOptions.fuelType"
                                :key="indexFuel"
                                :label="fuelType"
                                :value="fuelType"
                              ></el-option>
                            </el-select>
                          </span>
                        </el-tag>
                      </div>
                    </el-dialog>
                  </div>

                  <div class="setting_item">
                    Tech Solution
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="techSoluTableVisible=true"
                    >Edit</el-button>

                    <el-dialog
                      title="Tech Solution Table"
                      :visible.sync="techSoluTableVisible"
                      width="100%"
                      append-to-body
                      center
                    >
                      <div>
                        <!-- {{decarbonModel.techSolu}} -->
                        <div>
                          <el-switch
                            v-model="autoFill"
                            active-text="自动填充"
                            active-color="#13ce66"
                            style="margin:5px"
                          ></el-switch>
                          <el-button size="mini" style="margin: 5px" @click="addTechSolu">Add Tech</el-button>
                          <el-button
                            size="mini"
                            style="margin: 5px"
                            @click="resetTechSoluTable"
                          >Reset</el-button>
                        </div>
                        <el-tag :disable-transitions="false" style="margin: 10px;">
                          <el-col :span="1">Year:</el-col>
                          <span>
                            <el-input
                              v-for="(item, i) in selectOptions.deliveryYear"
                              :key="i"
                              :disabled="true"
                              v-model="selectOptions.deliveryYear[i]"
                              size="mini"
                              style="width: 3.5%;"
                            ></el-input>
                          </span>
                        </el-tag>
                        <el-tag
                          v-for="(item,index) in decarbonModel.techSolu"
                          :key="index"
                          :disable-transitions="false"
                          closable
                          @close="handleDelete(decarbonModel.techSolu,index)"
                          style="margin: 10px;"
                        >
                          <el-col :span="1">Tech {{index}}:</el-col>
                          <div>
                            <el-select
                              v-for="(t, j) in item.tech"
                              :key="j"
                              v-model="item.tech[j]"
                              size="mini"
                              style="width: 3.5%;"
                              @change="autoFill?setSolu(item.tech,j):()=>{}"
                            >
                              <el-option
                                v-for="(techType, indexTech) in selectOptions.techType"
                                :key="indexTech"
                                :label="techType"
                                :value="techType"
                              ></el-option>
                            </el-select>
                          </div>
                          <el-col :span="1">Tech Cost:</el-col>
                          <el-input
                            v-for="(c, i) in item.cost"
                            :key="i"
                            v-model="item.cost[i]"
                            size="mini"
                            style="width: 3.5%;"
                            @input="autoFill?setSolu(item.cost,i):()=>{}"
                          ></el-input>
                        </el-tag>
                      </div>
                    </el-dialog>
                  </div>

                  <div class="setting_item">
                    Oper Solution
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="operSoluTableVisible=true"
                    >Edit</el-button>

                    <el-dialog
                      title="Oper Solution Table"
                      :visible.sync="operSoluTableVisible"
                      width="100%"
                      append-to-body
                      center
                    >
                      <div>
                        <!-- {{decarbonModel.operSolu}} -->
                        <div>
                          <el-switch
                            v-model="autoFill"
                            active-text="自动填充"
                            active-color="#13ce66"
                            style="margin:5px"
                          ></el-switch>
                          <el-button size="mini" style="margin: 5px" @click="addOperSolu">Add Oper</el-button>
                          <el-button
                            size="mini"
                            style="margin: 5px"
                            @click="resetOperSoluTable"
                          >Reset</el-button>
                        </div>
                        <el-tag :disable-transitions="false" style="margin: 10px;">
                          <el-col :span="1">Year:</el-col>
                          <span>
                            <el-input
                              v-for="(item, i) in selectOptions.deliveryYear"
                              :key="i"
                              :disabled="true"
                              v-model="selectOptions.deliveryYear[i]"
                              size="mini"
                              style="width: 3.5%;"
                            ></el-input>
                          </span>
                        </el-tag>
                        <el-tag
                          v-for="(item,index) in decarbonModel.operSolu"
                          :key="index"
                          :disable-transitions="false"
                          closable
                          @close="handleDelete(decarbonModel.operSolu,index)"
                          style="margin: 10px;"
                        >
                          <el-col :span="1">Oper {{index}}:</el-col>
                          <div>
                            <el-select
                              v-for="(t, j) in item.oper"
                              :key="j"
                              v-model="item.oper[j]"
                              size="mini"
                              style="width: 3.5%;"
                              @change="autoFill?setSolu(item.oper,j):()=>{}"
                            >
                              <el-option
                                v-for="(operType, indexOper) in selectOptions.operType"
                                :key="indexOper"
                                :label="operType"
                                :value="operType"
                              ></el-option>
                            </el-select>
                          </div>
                          <el-col :span="1">Oper Cost:</el-col>
                          <el-input
                            v-for="(c, i) in item.cost"
                            :key="i"
                            v-model="item.cost[i]"
                            size="mini"
                            style="width: 3.5%;"
                            @input="autoFill?setSolu(item.cost,i):()=>{}"
                          ></el-input>
                        </el-tag>
                      </div>
                    </el-dialog>
                  </div>

                  <div class="setting_item">
                    FuelType Price
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="fuelPriceTableVisible=true"
                    >Edit</el-button>

                    <el-dialog
                      title="FuelType & Price Table"
                      :visible.sync="fuelPriceTableVisible"
                      width="100%"
                      append-to-body
                      center
                    >
                      <div>
                        <!-- {{fuelPriceModel}} -->
                        <div>
                          <el-switch
                            v-model="autoFill"
                            active-text="自动填充"
                            active-color="#13ce66"
                            style="margin:5px"
                          ></el-switch>
                          <el-button size="mini" style="margin: 5px" @click="addFuelPrice">Add Price</el-button>
                          <el-button
                            size="mini"
                            style="margin: 5px"
                            @click="resetFuelPriceTable"
                          >Reset</el-button>
                        </div>
                        <el-tag :disable-transitions="false" style="margin: 10px;">
                          <el-col :span="1">Year:</el-col>
                          <span>
                            <el-input
                              v-for="(item, i) in selectOptions.deliveryYear"
                              :key="i"
                              :disabled="true"
                              v-model="selectOptions.deliveryYear[i]"
                              size="mini"
                              style="width: 3.5%;"
                            ></el-input>
                          </span>
                        </el-tag>
                        <el-tag
                          v-for="(item,index) in fuelPriceModel"
                          :key="index"
                          :disable-transitions="false"
                          closable
                          @close="handleDelete(fuelPriceModel,index)"
                          style="margin: 10px;"
                        >
                          <el-col :span="1">FuelType {{index}}:</el-col>
                          <div>
                            <el-select v-model="item.fuelType" size="mini" style="width: 7%;">
                              <el-option
                                v-for="(fuelType, indexFuel) in selectOptions.fuelType"
                                :key="indexFuel"
                                :label="fuelType"
                                :value="fuelType"
                              ></el-option>
                            </el-select>
                          </div>
                          <el-col :span="1">Price:</el-col>
                          <el-input
                            v-for="(p, i) in item.price"
                            :key="i"
                            v-model="item.price[i]"
                            size="mini"
                            style="width: 3.5%;"
                            @input="autoFill?setSolu(item.price,i):()=>{}"
                          ></el-input>
                        </el-tag>
                      </div>
                    </el-dialog>
                  </div>

                  <div class="setting_item">
                    Carbon Price for ETS
                    <el-button
                      size="mini"
                      style="margin: 5px"
                      @click="fuelPenaltyTableVisible=true"
                    >Edit</el-button>

                    <el-dialog
                      title="Carbon Price for ETS Table"
                      :visible.sync="fuelPenaltyTableVisible"
                      width="100%"
                      append-to-body
                      center
                    >
                      <div>
                        <div>
                          <el-switch
                            v-model="autoFill"
                            active-text="自动填充"
                            active-color="#13ce66"
                            style="margin:5px"
                          ></el-switch>
                          <el-button
                            size="mini"
                            style="margin: 5px"
                            @click="resetCarbonPriceTable"
                          >Reset</el-button>
                        </div>

                        <el-tag :disable-transitions="false">
                          <el-col :span="1">Year:</el-col>
                          <span>
                            <el-input
                              v-for="(item, i) in selectOptions.deliveryYear"
                              :key="i"
                              :disabled="true"
                              v-model="selectOptions.deliveryYear[i]"
                              size="mini"
                              style="width: 3.5%;"
                            ></el-input>
                          </span>
                        </el-tag>

                        <el-tag :disable-transitions="false">
                          <el-col :span="1">Price ($/t):</el-col>
                          <span>
                            <el-input
                              v-for="(item, i) in carbonPriceModel"
                              :key="i"
                              v-model="carbonPriceModel[i]"
                              size="mini"
                              style="width: 3.5%;"
                              @input="autoFill?setSolu(carbonPriceModel,i):()=>{}"
                            ></el-input>
                          </span>
                        </el-tag>
                      </div>
                    </el-dialog>
                  </div>
                </el-collapse-item>

                <el-collapse-item>
                  <template slot="title">
                    <div class="left_shu">Temp Result</div>
                  </template>
                  <div class="setting_item">
                    <!-- {{fuelEUTable}} 
                    {{equalInterestTable}}
                    {{equalPaymentTable}}
                    {{pwindPprop}}
                    {{fwind}}
                    {{ppti}}
                    {{pae}}
                    {{ppto}}
                    {{pme}}
                    {{peff}}
                    {{pAEeff}}
                    {{cfMe1}}
                    {{cfMe2}}
                    {{cfAe1}}
                    {{cfAe2}}
                    {{cfPilot}}
                    {{densityMe1}}
                    {{densityMe2}}
                    {{densityMGO}}
                    {{lcvMe1}}
                    {{lcvMe2}}
                    {{lcvMGO}}
                    {{fdf}}
                    {{gasAvailability}}
                    {{liqAvailability}}
                    {{cap}} 
                    {{attEEDI}}
                    {{reducEEDIRefLine}}
                    {{reqEEDI}}
                    {{complianceEEDI}}
                    {{fc}}
                    {{resultCII}} 
                    {{fuelInflu}}
                    {{origInflu}}
                    {{emisCost}}
                    {{fuelPriceModel}}
                    {{techInflu}}
                    {{operInflu}}
                    {{fcReductionCargo}}
                    {{speedReduce}}
                    {{fuelSolution}}-->
                    {{decarbonModel}}
                  </div>
                </el-collapse-item>
              </el-collapse>
            </div>
          </el-tab-pane>

          <!-- Admin -->
          <el-tab-pane label="Admin">
            <span slot="label">
              <i class="el-icon-set-up"></i> Admin
            </span>
            <div class="setting_body">
              <div class="left_shu">Admin</div>
              <div class="setting_item">
                <span class="setting_label">
                  Automatic Adaptation
                  <span class="setting_label_tip">(1920*1080)</span>:
                </span>
                <div class="setting_content">
                  <el-radio-group
                    v-model="isScaleradio"
                    @change="val => commitChange(val, 'isScale')"
                  >
                    <el-radio :label="true">Yes</el-radio>
                    <el-radio :label="false">No</el-radio>
                  </el-radio-group>
                  <div class="flex justify-center">
                    <el-button type="primary" round size="mini" @click="clearStorage">Clear Storage</el-button>
                  </div>
                </div>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </transition>
</template>


<script>
export default {
  components: {},
  data() {
    return {
      settingShow: false,
      sbtxradio: true,
      ssyjradio: true,
      isScaleradio: true,
      startYear: 2024,
      endYear: 2050,
      history: "",
      histories: [],
      inputVisible: false,
      inputValue: "",
      fuelSoluTableVisible: false,
      techSoluTableVisible: false,
      operSoluTableVisible: false,
      fuelPriceTableVisible: false,
      fuelPenaltyTableVisible: false,
      autoFill: true,
      //Input
      vesselModel: {
        projectName: "",
        shipName: "",
        imo: "",
        loa: "",
        lpp: "",
        beam: "",
        depth: "",
        dwt: "",
        gt: "",
        dd: "",
        sd: "",
        ds: "",
        ss: "",
        ch: "",
        cb: "",
        lwt: "",
        disp: "",
        mcr: "",
        csr: ""
      },
      vesselLable: {
        projectName: "Project name",
        shipName: "Ship Name",
        imo: "IMO Number",
        loa: "Loa (m)",
        lpp: "Lpp (m)",
        beam: "Beam (m)",
        depth: "Depth (m)",
        dwt: "Deadweight (t)",
        gt: "Gross Tonnage (t)",
        dd: "Design Draft (m)",
        sd: "Speed @design (kn)",
        ds: "Scantling Draft (m)",
        ss: "Speed @Stantling (kn)",
        ch: "Cargo tanks/holds capacity (m3)",
        cb: "Cb @scantling draft",
        lwt: "Lightweight(LWT) (t)",
        disp: "Volumetric displacement(▽) (t)",
        mcr: "MCR (kW)",
        csr: "CSR (kW)"
      },
      eediModel: {
        numberPTI: "",
        ratedPowerPTI: "",
        weightedAverageEfficiency: "",
        numberPTO: "",
        ratedPowerPTO: "",
        numberCranes: "",
        swl: "",
        reachSWL: "",
        fjroro: "",
        fw: "",
        fiVSE: "",
        fjgen: "",
        vref: ""
      },
      eediLable: {
        numberPTI: "The number of the PTI",
        ratedPowerPTI: "Rated power of PTI (kW)",
        weightedAverageEfficiency: "The weighted average efficiency ",
        numberPTO: "The number of the PTO",
        ratedPowerPTO: "Rated power of PTO (kW)",
        numberCranes: "Number of cranes (N)",
        swl: "Safe working load (SWL)",
        reachSWL: "Reach at which the SWL can be applied",
        fjroro: "fjroro",
        fw: "fw",
        fiVSE: "fiVSE",
        fjgen: "fjgen",
        vref: "EEDI Speed (Vref)"
      },
      eexiModel: {
        deliveryYear: "",
        attainedEEDI: "",
        vsEEDI: "",
        psEEDI: "",
        mcrLim: ""
      },
      eexiLable: {},
      ciiModel: {
        displacementLaden: "",
        distance: "",
        deductedFuelRatio: "",
        deductedDistanceRatio: "",
        deductedRatioFcElectrical: "",
        deductedRatioFcBoiler: "",
        deductedRatioFcOthers: "",
        typicalRoute: "",
        voyageMargin: "",
        cargoing: "",
        berthTime: "",
        reductionFactor2026: "",
        reductionFactor2030: "",
        reductionFactor2040: "",
        consumptionIncreasing: ""
      },
      ciiLable: {
        displacementLaden: "Displacement @ Laden (t)",
        distance: "Distance (Round trip) (nm)",
        deductedFuelRatio: "Deducted fuel Ratio (Round trip) (%)",
        deductedDistanceRatio: "Deducted distance Ratio (Round trip) (%)",
        deductedRatioFcElectrical: "Deducted ratio of FC electrical,j (%)",
        deductedRatioFcBoiler: "Deducted ratio of FC boiler,j (%)",
        deductedRatioFcOthers: "Deducted ratio of FC others,j (%)",
        typicalRoute: "Typical Route",
        voyageMargin: "Voyage Margin for a round-trip (%)",
        cargoing: "Cargoing(Loading+Unloading) (days)",
        berthTime: "Berth time (days)",
        reductionFactor2026: "Reduction factor after 2026 (%)",
        reductionFactor2030: "Reduction factor after 2030 (%)",
        reductionFactor2040: "Reduction factor after 2040 (%)",
        consumptionIncreasing:
          "Consumption Increasing every year (Machine/hull Factors) (%)"
      },
      fuelEUModel: {
        voyageRatio: "",
        berth: "",
        anchor: "",
        cargo: "",
        ek: "",
        co2: "",
        eurEqualsUSD: "",
        carbonPriceETS: "",
        carbonPrice: ""
      },
      fuelEULable: {
        voyageRatio:
          "Voyage Ratio within the scope of FuelEU (a roundtrip) (%)",
        berth: "Berth within  the scope of FuelEU (%)",
        anchor: "Anchor within  the scope of FuelEU (%)",
        cargo: "Cargo within  the scope of FuelEU (%)",
        ek: "Ek (offshore power) (Mj)",
        co2: "CO2 eqelectricity (gCO2eq/g)",
        eurEqualsUSD: "EUR equals USD",
        carbonPriceETS: "carbon price for ETS ($/t)",
        carbonPrice: "carbon price for Carbon price ($/t)"
      },
      economicModel: {
        fixedOPEX: "",
        increasingRateOPEX: "",
        floatingOPEXAverage: "",
        floatingOPEXIncreasement: "",
        cargoMass: ""
      },
      economicLable: {
        fixedOPEX: "Basic fixed OPEX per year ($)",
        increasingRateOPEX: "Increasing rate of OPEX per year (%)",
        floatingOPEXAverage: "Floating OPEX of average round trip ($)",
        floatingOPEXIncreasement:
          "Floating OPEX  increasement every round trip (%)",
        cargoMass: "Cargo mass (t/TEU)"
      },
      selfOperatingModel: {
        newBuildingCost: "",
        otherBuildingCost: "",
        residualValue: "",
        loanValueRatio: "",
        loanInterestRate: "",
        loanTerm: "",
        beginYearLoan: "",
        buildingPeriod: "",
        discountRate: "",
        freight: "",
        increasingRateFreight: ""
      },
      selfOperatingLable: {
        newBuildingCost: "New building cost ($)",
        otherBuildingCost: "Other building cost ($)",
        residualValue: "Residual value ($)",
        loanValueRatio: "Loan to value ratio (%)",
        loanInterestRate: "Loan Interest rate (annual) (%)",
        loanTerm: "Loan term (Y)",
        beginYearLoan: "The begin year of loan payment",
        buildingPeriod: "Building period (Y)",
        discountRate: "Discount rate (%)",
        freight: "Freight ($/t)",
        increasingRateFreight: "Increasing rate of Freight per year (%)"
      },
      charteringModel: {
        fixedOPEX: "",
        increasingRateOPEX: "",
        floatingOPEXAverage: "",
        floatingOPEXIncreasement: "",
        expectedDailyChartRate: "",
        increasingRatioChartRate: "",
        Freight: "",
        increasingRateFreight: ""
      },
      charteringLable: {
        fixedOPEX:
          "Basic fixed OPEX of average round trip(Depreciation excluded) ($)",
        increasingRateOPEX: "Increasing ratio of OPEX per year (%)",
        floatingOPEXAverage: "Floating OPEX of average round trip ($)",
        floatingOPEXIncreasement:
          "Floating OPEX  increasement every round trip (%)",
        expectedDailyChartRate: "Expected Daily chart rate ($)",
        increasingRatioChartRate: "Increasing ratio of Chart rate per year (%)",
        Freight: "Freight ($/t)",
        increasingRateFreight: "Freight increasing rate (%)"
      },
      //Decarbon Path
      targetModel: {
        speedLaden: "",
        speedBallast: "",
        target: ""
      },
      targetLable: {
        speedLaden: "Speed @ laden (Kn)",
        speedBallast: "Speed @ Ballast (Kn)",
        target: "EEDI/EEXI (%)"
      },
      //1. Fuel Info
      fuelInfoModel: {
        fcMELaden: [
          { fuelType: "None", fc: [0, 0, 0, 0] },
          { fuelType: "None", fc: [0, 0, 0, 0] }
        ],
        fcMEBallast: [
          { fuelType: "None", fc: [0, 0, 0, 0] },
          { fuelType: "None", fc: [0, 0, 0, 0] }
        ],
        fcAEVoyage: [
          { fuelType: "None", fc: "" },
          { fuelType: "None", fc: "" }
        ],
        fcAEBerth: [{ fuelType: "None", fc: "" }, { fuelType: "None", fc: "" }],
        fcAECargo: [{ fuelType: "None", fc: "" }, { fuelType: "None", fc: "" }],
        fcPilot: [{ fuelType: "MDO/MGO", fc: 0.5 }]
      },
      sfcModel: {
        sfcMe1: "",
        sfcMe2: "",
        sfcMePilot: "",
        sfcAe1: "",
        sfcAe2: "",
        sfcAePilot: ""
      },
      sfcLable: {
        sfcMe1: "SFCME LNG (Fuel 1) (g/kWh)",
        sfcMe2: "SFCME Fuel (Fuel 2) (g/kWh)",
        sfcMePilot: "SFCME Pilotfuel (Fuel 3) (g/kWh)",
        sfcAe1: "SFCAE LNG (g/kWh)",
        sfcAe2: "SFCAE Fuel (g/kWh)",
        sfcAePilot: "SFCAE Pilot fuel (g/kWh)"
      },
      fuelTanksModel: {
        fuel1TypeCapacity: "",
        fuel2TypeCapacity: "",
        fuel3TypeCapacity: ""
      },
      technicalModel: {
        pWind: ""
      },
      fuelPriceModel: [{ fuelType: "None", price: new Array(27).fill(0) }],
      carbonPriceModel: new Array(27).fill(0),
      //4. Decarbon Solutions (显示)	Result表格的上半蓝色部分
      decarbonModel: {
        fuelSolu: {
          mainFuel: [],
          mainRatio: [],
          dualFuel: [],
          dualRatio: [],
          voyageAE: [],
          berthAE: [],
          cargoAE: [],
          pilotOil: [],
          cost: []
        },
        techSolu: [
          { tech: new Array(27).fill("None"), cost: new Array(27).fill(0) }
        ],
        operSolu: [
          { oper: new Array(27).fill("None"), cost: new Array(27).fill(0) }
        ]
      },

      //radioModel and selectModel
      radioModel: {
        isNewbuilding: true,
        isHCSR: true,
        isChartering: true,
        isEqualPrincipalPayment: true,
        isFueEU: true,
        isEUETS: true,
        isOtherCarbonPrice: true
      },
      selectModel: {
        shipType: "Bulk carrier",
        iceClass: "None",
        requirementEEDI: "Phase 0",
        fuel1TankType: "Regular",
        fuel2TankType: "Regular",
        fuel3TankType: "Regular",
        ciiRating: "A",
        reduction2026: 2.0,
        fuelType: "None",
        techType: "None",
        operType: "None",
        loanRepayFrequency: "Once a year",
        ciiLimitYear: "2050",
        deliveryYear: "2024",
        fuelMode: "Dual Fuel"
      },
      selectOptions: {
        shipType: [
          "Bulk carrier",
          "Gas carrier",
          "Tanker",
          "Chemical Tanker",
          "Container ship",
          "General Cargo ship",
          "Refrigerated cargo carrier",
          "Combination carrier",
          "LNG carrier",
          "Ro-ro cargo ship (vehicle carrier)",
          "Ro-ro cargo ship",
          "Ro-ro passenger ship",
          "Ro-ro passenger ship (HSC)",
          "Cruise Passenger ship"
        ],
        iceClass: ["None", "IA Super", "IA", "IB", "IC"],
        reduction2026: [2.0, 3.1],
        requirementEEDI: [
          "Phase 0",
          "Phase 1",
          "Phase 2",
          "Phase 3",
          "Pre-EEDI"
        ],
        fuelTankType: ["Regular", "A type", "B type", "C type", "Membrane"],
        ciiRating: ["A", "B", "C", "D", "E"],
        fuelType: [
          "None",
          "HFO",
          "LSFO",
          "ULSFO",
          "VLSFO",
          "LFO",
          "MDO/MGO",
          "LNG(LP 4S)",
          "LNG(LP 2S)",
          "LNG(HP 2S)",
          "LPG(Butane)",
          "LPG(Propane)",
          "H2(NG-Fuel cell)",
          "H2(NG-ICE)",
          "NH3(NG)",
          "Methanol(NG)",
          "Bio-Ethanol",
          "Bio-diesel",
          "HVO",
          "Bio-LNG(LP 4S)",
          "Bio-LNG(LP 2S)",
          "Bio-LNG(HP 2S)",
          "Bio-methanol",
          "Other Bio-fuel",
          "Bio-H2(Fuel cell)",
          "Bio-H2(ICE)",
          "e-diesel",
          "e-methanol",
          "e-LNG",
          "e-LNG",
          "e-LNG",
          "e-H2(Fuel cell)",
          "e-H2(ICE)",
          "e-NH3(Fuel cell)",
          "e-NH3(ICE)",
          "e-LPG(Butane)",
          "e-LPG(Propane)",
          "e-DME",
          "Electricity"
        ],
        techType: [
          "None",
          "Duct",
          "Fan cap",
          "Rudder bulb",
          "Twistted rudder",
          "PTO",
          "PTI",
          "CPP & Engine optimization",
          "Hull coating",
          "Ail lubrication",
          "Rotors/sails",
          "Watse Heat recovery system",
          "Solar power",
          "Shore power",
          "Battery package",
          "Variable Freq drive",
          "CCS 50%",
          "CCS 99%"
        ],
        operType: [
          "None",
          "Hull cleaning",
          "Propeller cleaning",
          "Trim optimization",
          "Enginge load optimization",
          "Smart routing",
          "Speed redu. by 1 kn",
          "Speed redu. by 2 kn",
          "Speed redu. by 3 kn",
          "Cargo redu. by 10%",
          "Cargo redu. by 20%",
          "Cargo redu. by 30%"
        ],

        loanRepayFrequency: [
          "Once a year",
          "Once a half year",
          "Once a quarter"
        ],
        deliveryYear: [
          "2024",
          "2025",
          "2026",
          "2027",
          "2028",
          "2029",
          "2030",
          "2031",
          "2032",
          "2033",
          "2034",
          "2035",
          "2036",
          "2037",
          "2038",
          "2039",
          "2040",
          "2041",
          "2042",
          "2043",
          "2044",
          "2045",
          "2046",
          "2047",
          "2048",
          "2049",
          "2050"
        ],
        fuelMode: ["Single Fuel", "Dual Fuel"]
      },

      //data2
      fuelEUs: [
        {
          Fuel: "None",
          LCV: 0,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0,
          Cslip: 0,
          FuelType: "none",
          LCVEEDI: 0,
          Density: 0
        },
        {
          Fuel: "HFO",
          LCV: 0.0405,
          CO2eqWtT: 13.5,
          CfCO2: 3.114,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "regular",
          LCVEEDI: 40200,
          Density: 980
        },
        {
          Fuel: "LSFO",
          LCV: 0.0405,
          CO2eqWtT: 13.7,
          CfCO2: 3.151,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "regular",
          LCVEEDI: 40200,
          Density: 980
        },
        {
          Fuel: "ULSFO",
          LCV: 0.0405,
          CO2eqWtT: 13.2,
          CfCO2: 3.114,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "regular",
          LCVEEDI: 40200,
          Density: 980
        },
        {
          Fuel: "VLSFO",
          LCV: 0.041,
          CO2eqWtT: 13.2,
          CfCO2: 3.206,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "regular",
          LCVEEDI: 40200,
          Density: 980
        },
        {
          Fuel: "LFO",
          LCV: 0.041,
          CO2eqWtT: 13.2,
          CfCO2: 3.151,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "regular",
          LCVEEDI: 41200,
          Density: 980
        },
        {
          Fuel: "MDO/MGO",
          LCV: 0.0427,
          CO2eqWtT: 14.4,
          CfCO2: 3.206,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "regular",
          LCVEEDI: 42700,
          Density: 850
        },
        {
          Fuel: "LNG(LP 4S)",
          LCV: 0.0491,
          CO2eqWtT: 18.5,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 3.1,
          FuelType: "fossil",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "LNG(LP 2S)",
          LCV: 0.0491,
          CO2eqWtT: 18.5,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 1.7,
          FuelType: "fossil",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "LNG(HP 2S)",
          LCV: 0.0491,
          CO2eqWtT: 18.5,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 0.2,
          FuelType: "fossil",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "LPG(Butane)",
          LCV: 0.046,
          CO2eqWtT: 7.8,
          CfCO2: 3.03,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 3.1,
          FuelType: "fossil",
          LCVEEDI: 45700,
          Density: 600
        },
        {
          Fuel: "LPG(Propane)",
          LCV: 0.046,
          CO2eqWtT: 7.8,
          CfCO2: 3,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 3.1,
          FuelType: "fossil",
          LCVEEDI: 46300,
          Density: 600
        },
        {
          Fuel: "H2(NG-Fuel cell)",
          LCV: 0.12,
          CO2eqWtT: 132,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0,
          Cslip: 0,
          FuelType: "fossil",
          LCVEEDI: "N/A",
          Density: "N/A"
        },
        {
          Fuel: "H2(NG-ICE)",
          LCV: 0.12,
          CO2eqWtT: 132,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "fossil",
          LCVEEDI: 120200,
          Density: 71
        },
        {
          Fuel: "NH3(NG)",
          LCV: 0.0186,
          CO2eqWtT: 121,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "fossil",
          LCVEEDI: 18600,
          Density: 680
        },
        {
          Fuel: "Methanol(NG)",
          LCV: 0.0199,
          CO2eqWtT: 31.3,
          CfCO2: 1.375,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "fossil",
          LCVEEDI: 19900,
          Density: 790
        },
        {
          Fuel: "Bio-Ethanol",
          LCV: 0.027,
          CO2eqWtT: 10,
          CfCO2: 1.913,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "Liquid Biofuels",
          LCVEEDI: 26800,
          Density: 790
        },
        {
          Fuel: "Bio-diesel",
          LCV: 0.037,
          CO2eqWtT: 10,
          CfCO2: 2.834,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "Liquid Biofuels",
          LCVEEDI: 40200,
          Density: 980
        },
        {
          Fuel: "HVO",
          LCV: 0.037,
          CO2eqWtT: 10,
          CfCO2: 3.115,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "Liquid Biofuels",
          LCVEEDI: "N/A",
          Density: "N/A"
        },
        {
          Fuel: "Bio-LNG(LP 4S)",
          LCV: 0.05,
          CO2eqWtT: 10,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 3.1,
          FuelType: "Liquid Biofuels",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "Bio-LNG(LP 2S)",
          LCV: 0.05,
          CO2eqWtT: 10,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 1.7,
          FuelType: "Liquid Biofuels",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "Bio-LNG(HP 2S)",
          LCV: 0.05,
          CO2eqWtT: 10,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 0.2,
          FuelType: "Liquid Biofuels",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "Bio-methanol",
          LCV: 0.02,
          CO2eqWtT: 20,
          CfCO2: 1.375,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "Liquid Biofuels",
          LCVEEDI: 19900,
          Density: 790
        },
        {
          Fuel: "Other Bio-fuel",
          LCV: 0,
          CO2eqWtT: 0,
          CfCO2: 3.115,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "Liquid Biofuels",
          LCVEEDI: "N/A",
          Density: "N/A"
        },
        {
          Fuel: "Bio-H2(Fuel cell)",
          LCV: 0.12,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0,
          Cslip: 0,
          FuelType: "Gaseous Biofuels",
          LCVEEDI: "N/A",
          Density: "N/A"
        },
        {
          Fuel: "Bio-H2(ICE)",
          LCV: 0.12,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "Gaseous Biofuels",
          LCVEEDI: 120200,
          Density: 71
        },
        {
          Fuel: "e-diesel",
          LCV: 0.0427,
          CO2eqWtT: 0,
          CfCO2: 3.206,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "e-fuel",
          LCVEEDI: 40200,
          Density: 980
        },
        {
          Fuel: "e-methanol",
          LCV: 0.0199,
          CO2eqWtT: 0,
          CfCO2: 1.375,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "e-fuel",
          LCVEEDI: 19900,
          Density: 790
        },
        {
          Fuel: "e-LNG",
          LCV: 0.0491,
          CO2eqWtT: 0,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 3.1,
          FuelType: "e-fuel",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "e-LNG",
          LCV: 0.0491,
          CO2eqWtT: 0,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 1.7,
          FuelType: "e-fuel",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "e-LNG",
          LCV: 0.0491,
          CO2eqWtT: 0,
          CfCO2: 2.75,
          CfCH4: 0,
          CfN2O: 0.00011,
          Cslip: 0.2,
          FuelType: "e-fuel",
          LCVEEDI: 48000,
          Density: 450
        },
        {
          Fuel: "e-H2(Fuel cell)",
          LCV: 0.12,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0,
          Cslip: 0,
          FuelType: "e-fuel",
          LCVEEDI: "N/A",
          Density: "N/A"
        },
        {
          Fuel: "e-H2(ICE)",
          LCV: 0.12,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "e-fuel",
          LCVEEDI: 120200,
          Density: 71
        },
        {
          Fuel: "e-NH3(Fuel cell)",
          LCV: 0.0186,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 3.1,
          FuelType: "e-fuel",
          LCVEEDI: "N/A",
          Density: "N/A"
        },
        {
          Fuel: "e-NH3(ICE)",
          LCV: 0.0189,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 3.1,
          FuelType: "e-fuel",
          LCVEEDI: 18600,
          Density: 680
        },
        {
          Fuel: "e-LPG(Butane)",
          LCV: 0.033,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 3.1,
          FuelType: "e-fuel",
          LCVEEDI: 45700,
          Density: 600
        },
        {
          Fuel: "e-LPG(Propane)",
          LCV: 0.031,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 3.1,
          FuelType: "e-fuel",
          LCVEEDI: 46300,
          Density: 600
        },
        {
          Fuel: "e-DME",
          LCV: 0.028,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0.00005,
          CfN2O: 0.00018,
          Cslip: 0,
          FuelType: "e-fuel",
          LCVEEDI: "N/A",
          Density: "N/A"
        },
        {
          Fuel: "Electricity",
          LCV: 0,
          CO2eqWtT: 0,
          CfCO2: 0,
          CfCH4: 0,
          CfN2O: 0,
          Cslip: 0,
          FuelType: "others",
          LCVEEDI: "N/A",
          Density: "N/A"
        }
      ],
      techEfficiencies: {
        None: {
          reduME: 0,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        Duct: {
          reduME: 1,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Fan cap": {
          reduME: 1,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Rudder bulb": {
          reduME: 1,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Twistted rudder": {
          reduME: 1,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        PTO: {
          reduME: 3,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        PTI: {
          reduME: 3,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "CPP & Engine optimization": {
          reduME: 3,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Hull coating": {
          reduME: 1,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Ail lubrication": {
          reduME: 0,
          reduAE: 0,
          reduPeff: 5,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Rotors/sails": {
          reduME: 0,
          reduAE: 0,
          reduPeff: 8,
          reduCO2: 0,
          cargoLoss: 0.5
        },
        "Watse Heat recovery system": {
          reduME: 0,
          reduAE: 3,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Solar power": {
          reduME: 0,
          reduAE: 1,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Shore power": {
          reduME: 0,
          reduAE: 1,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Battery package": {
          reduME: 0,
          reduAE: 1,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "Variable Freq drive": {
          reduME: 0,
          reduAE: 1,
          reduPeff: 0,
          reduCO2: 0,
          cargoLoss: 0
        },
        "CCS 50%": {
          reduME: 0,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 47,
          cargoLoss: 3
        },
        "CCS 99%": {
          reduME: 0,
          reduAE: 0,
          reduPeff: 0,
          reduCO2: 90,
          cargoLoss: 3
        }
      },
      operEfficiencies: {
        None: 0,
        "Hull cleaning": 5,
        "Propeller cleaning": 1,
        "Trim optimization": 2,
        "Enginge load optimization": 5,
        "Smart routing": 5,
        "Speed redu. by 1 kn": 0,
        "Speed redu. by 2 kn": 0,
        "Speed redu. by 3 kn": 0,
        "Cargo redu. by 10%": 0,
        "Cargo redu. by 20%": 0,
        "Cargo redu. by 30%": 0
      },
      operCargoLoss: {
        None: 0,
        "Hull cleaning": 0,
        "Propeller cleaning": 0,
        "Trim optimization": 0,
        "Enginge load optimization": 0,
        "Smart routing": 0,
        "Speed redu. by 1 kn": 0,
        "Speed redu. by 2 kn": 0,
        "Speed redu. by 3 kn": 0,
        "Cargo redu. by 10%": 10,
        "Cargo redu. by 20%": 20,
        "Cargo redu. by 30%": 30
      },
      operSpeedRedu: {
        None: 0,
        "Hull cleaning": 0,
        "Propeller cleaning": 0,
        "Trim optimization": 0,
        "Enginge load optimization": 0,
        "Smart routing": 0,
        "Speed redu. by 1 kn": 1,
        "Speed redu. by 2 kn": 2,
        "Speed redu. by 3 kn": 3,
        "Cargo redu. by 10%": 0,
        "Cargo redu. by 20%": 0,
        "Cargo redu. by 30%": 0
      },
      fillingRatios: {
        Regular: 0.98,
        "A type": 0.95,
        "B type": 0.95,
        "C type": 0.85,
        Membrane: 0.95
      }
    };
  },

  computed: {
    //data1-CII
    x: function() {
      let xDic = {
        "Bulk carrier": {
          a: 4745,
          c: 0.622,
          d1: 0.86,
          d2: 0.94,
          d3: 1.06,
          d4: 1.18
        },
        "Gas carrier": {
          a: this.capacity >= 65000 ? 144050000000 : 8104,
          c: this.capacity >= 65000 ? 2.071 : 0.639,
          d1: this.capacity < 65000 ? 0.85 : 0.81,
          d2: this.capacity < 65000 ? 0.95 : 0.91,
          d3: this.capacity < 65000 ? 1.06 : 1.12,
          d4: this.capacity < 65000 ? 1.25 : 1.44
        },
        Tanker: {
          a: 5247,
          c: 0.61,
          d1: 0.82,
          d2: 0.93,
          d3: 1.08,
          d4: 1.28
        },
        "Container ship": {
          a: 1984,
          c: 0.489,
          d1: 0.83,
          d2: 0.94,
          d3: 1.07,
          d4: 1.19
        },
        "General Cargo ship": {
          a: this.capacity >= 20000 ? 31948 : 588,
          c: this.capacity >= 20000 ? 0.792 : 0.3885,
          d1: 0.83,
          d2: 0.94,
          d3: 1.06,
          d4: 1.19
        },
        "Refrigerated cargo carrier": {
          a: 4600,
          c: 0.62,
          d1: 0.78,
          d2: 0.91,
          d3: 1.07,
          d4: 1.2
        },
        "Combination carrier": {
          a: 5119,
          c: 0.812,
          d1: 0.87,
          d2: 0.96,
          d3: 1.06,
          d4: 1.14
        },
        "Ro-ro cargo ship (vehicle carrier)": {
          a: this.capacity >= 30000 ? 3627 : 330,
          c: this.capacity >= 30000 ? 0.59 : 0.329,
          d1: 0.86,
          d2: 0.94,
          d3: 1.06,
          d4: 1.16
        },
        "Ro-ro cargo ship": {
          a: 1967,
          c: 0.485,
          d1: 0.76,
          d2: 0.89,
          d3: 1.08,
          d4: 1.27
        },
        "Ro-ro passenger ship": {
          a: 2023,
          c: 0.46,
          d1: 0.76,
          d2: 0.92,
          d3: 1.14,
          d4: 1.3
        },
        "LNG carrier": {
          a: this.capacity >= 100000 ? 9.827 : 144790000000000,
          c: this.capacity >= 100000 ? 0 : 2.673,
          d1: this.capacity >= 100000 ? 0.89 : 0.78,
          d2: this.capacity >= 100000 ? 0.98 : 0.92,
          d3: this.capacity >= 100000 ? 1.06 : 1.1,
          d4: this.capacity >= 100000 ? 1.13 : 1.37
        },
        "Cruise passenger ship": {
          a: 930,
          c: 0.383,
          d1: 0.87,
          d2: 0.95,
          d3: 1.06,
          d4: 1.16
        },
        "Chemical Tanker": {
          a: 5247,
          c: 0.61,
          d1: 0.82,
          d2: 0.93,
          d3: 1.08,
          d4: 1.28
        },
        "Ro-ro passenger ship (HSC)": {
          a: 6167,
          c: 0.46,
          d1: 0.76,
          d2: 0.92,
          d3: 1.14,
          d4: 1.3
        }
      };
      return xDic[this.selectModel.shipType];
    },
    //data1-CII ref
    refCII: function() {
      return this.x.a / Math.pow(this.capacity, this.x.c);
    },
    //data1-Capacity
    capacity: function() {
      let c = this.grossOption ? this.vesselModel.gt : this.vesselModel.dwt;
      return this.selectModel.shipType === "Bulk carrier"
        ? Math.min(c, 279000)
        : this.selectModel.shipType === "LNG carrier"
        ? Math.max(c, 65000)
        : this.selectModel.shipType === "Ro-ro cargo ship (vehicle carrier)"
        ? Math.min(c, 57700)
        : c;
    },
    //data1-Capacity for reference
    grossOption: function() {
      return (
        this.selectModel.shipType.includes("Ro-ro") ||
        this.selectModel.shipType.includes("Cruise")
      );
    },
    //data1-fi
    fi: function() {
      let fiIce = {
        "IA Super":
          1.0151 + 228.7 / Number(this.vesselModel.dwt) > 1.05
            ? 1.0151 + 228.7 / Number(this.vesselModel.dwt)
            : 1,
        IA:
          1.0099 + 95.1 / Number(this.vesselModel.dwt) > 1.05
            ? 1.0099 + 95.1 / Number(this.vesselModel.dwt)
            : 1,
        IB: 1.0067 + 62.7 / Number(this.vesselModel.dwt),
        IC: 1.0041 + 58.5 / Number(this.vesselModel.dwt),
        None: 1
      };
      let cbRef = {
        "General Cargo ship": 0.8,
        Tanker:
          Number(this.vesselModel.dwt) < 25000
            ? 0.78
            : Number(this.vesselModel.dwt) < 55000
            ? 0.8
            : 0.83,
        "Bulk carrier":
          Number(this.vesselModel.dwt) < 10000
            ? 0.78
            : Number(this.vesselModel.dwt) < 25000
            ? 0.8
            : Number(this.vesselModel.dwt) < 55000
            ? 0.82
            : 0.86
      };
      let ficb =
        cbRef[this.selectModel.shipType] === undefined
          ? 1.0
          : cbRef[this.selectModel.shipType] / this.vesselModel.cb;
      return this.selectModel.iceClass === "None"
        ? 1.0
        : fiIce[this.selectModel.iceClass] * ficb;
    },
    //data1-fiCSR
    fiCSR: function() {
      return this.radioModel.isHCSR
        ? 1 + (0.08 * this.vesselModel.lwt) / this.vesselModel.dwt
        : 1.0;
    },
    //data1-R
    R: function() {
      return this.vesselModel.dwt / this.vesselModel.ch;
    },
    //data1-fc
    fc: function() {
      if (this.selectModel.shipType === "Chemical Tanker") {
        return this.R < 0.98
          ? (Math.pow(this.R, -0.7) - 0.014).toFixed(3)
          : 1.0;
      } else if (this.selectModel.shipType === "Ro-ro passenger ship") {
        return this.vesselModel.dwt / this.vesselModel.gt < 0.25
          ? Math.pow(
              this.vesselModel.dwt / (this.vesselModel.gt * 0.25),
              -0.8
            ).toFixed(3)
          : 1.0;
      } else if (this.selectModel.shipType === "Bulk carrier") {
        return this.R < 0.55 ? Math.pow(this.R, -0.15).toFixed(3) : 1.0;
      } else if (this.selectModel.shipType === "Gas carrier") {
        let f = this.decarbonModel.fuelSolu.mainFuel[
          Number(this.selectModel.deliveryYear) - 2024
        ];
        return f.indexOf("MDO") > 0 || f.indexOf("FO") > 0
          ? Math.pow(this.R, -0.56).toFixed(3)
          : 1.0; //???
      }
      return 1.0;
    },
    //data1-fm
    fm: function() {
      return this.selectModel.iceClass.indexOf("IA") >= 0 ? 1.05 : 1;
    },
    //CII-Z factor
    zFactor: function() {
      let z = 5;
      let res = [];
      for (let index = 0; index < this.yearsLength; index++) {
        let redu =
          index < 3 //2026
            ? 2
            : index < 7 //2030
            ? Number(this.ciiModel.reductionFactor2026)
            : index < 17 //2040
            ? Number(this.ciiModel.reductionFactor2030)
            : Number(this.ciiModel.reductionFactor2040);
        z += redu;
        res.push(z);
      }
      return res;
    },
    //CII-Result
    resultCII: function() {
      let res = {
        totalDistance: [],
        attCII: [],
        reqCII: [],
        att_req: [],
        rankA: [],
        rankB: [],
        rankC: [],
        rankD: [],
        rating: [],
        compliance: []
      };
      let c = this.grossOption ? this.vesselModel.gt : this.vesselModel.dwt;
      for (let index = 0; index < this.zFactor.length; index++) {
        let operPeriod = Math.max(
          this.selectOptions.deliveryYear[index] -
            this.selectModel.deliveryYear +
            1,
          0
        );
        let totalDistance =
          this.ciiModel.distance * this.fuelSolution.actVoyageTimes[index] -
          this.ciiModel.deductedRatioFcOthers;
        let attCII =
          operPeriod == 0
            ? 0
            : Math.max(
                (this.emisCost.totalDecarbonCO2[index] * 1000000) /
                  (c *
                    this.eediModel.fiVSE *
                    this.fi *
                    this.fc *
                    this.fm *
                    totalDistance),
                0
              );
        let reqCII =
          operPeriod == 0
            ? 0
            : ((100 - this.zFactor[index]) / 100) * this.refCII;
        let att_req = reqCII == 0 ? 0 : attCII / reqCII;
        let rankA = this.x.d1 * reqCII;
        let rankB = this.x.d2 * reqCII;
        let rankC = this.x.d3 * reqCII;
        let rankD = this.x.d4 * reqCII;
        let rating =
          att_req < this.x.d1
            ? "A"
            : att_req < this.x.d2
            ? "B"
            : att_req < this.x.d3
            ? "C"
            : att_req < this.x.d4
            ? "D"
            : "E";
        let compliance = rating > this.selectModel.ciiRating ? "No" : "Yes";
        res.totalDistance.push(totalDistance);
        res.attCII.push(attCII);
        res.reqCII.push(reqCII);
        res.att_req.push(att_req);
        res.rankA.push(rankA);
        res.rankB.push(rankB);
        res.rankC.push(rankC);
        res.rankD.push(rankD);
        res.rating.push(rating);
        res.compliance.push(compliance);
      }
      return res;
    },
    //CII-Limited Year
    limitedYearCII: function() {
      let rating = this.resultCII.rating;
      let index = rating.length - 1;
      for (let i = 0; i < rating.length; i++) {
        let flag =
          rating[i] == "E" ||
          (i > 1 &&
            rating[i] == "D" &&
            rating[i - 1] == "D" &&
            rating[i - 2] == "D");
        if (flag) {
          index = i;
          break;
        }
      }
      return this.selectOptions.deliveryYear[index];
    },
    //data3-EEDI-Reference line
    bslnv: function() {
      //a Ro-ro cargo ship (Vehicle carrier)
      let aRoroVehicle =
        this.vesselModel.dwt / this.vesselModel.gt < 0.3
          ? Math.pow(this.vesselModel.dwt / this.vesselModel.gt, -0.7) * 780.36
          : 1812.63;
      // a Ro-ro cargo ship
      let aRoro =
        this.selectModel.requirementEEDI === "Phase 2" ||
        this.selectModel.requirementEEDI === "Phase 3"
          ? 1686.17
          : 1405.15;
      //a and c Dictionary
      let factorDic = {
        "Bulk carrier": {
          a: 961.79,
          c: 0.477
        },
        "Gas carrier": {
          a: 1120,
          c: 0.456
        },
        Tanker: {
          a: 1218.8,
          c: 0.488
        },
        "Chemical Tanker": {
          a: 1218.8,
          c: 0.488
        },
        "Container ship": {
          a: 174.22,
          c: 0.201
        },
        "General Cargo ship": {
          a: 107.48,
          c: 0.216
        },
        "Refrigerated cargo carrier": {
          a: 227.01,
          c: 0.244
        },
        "Combination carrier": {
          a: 1219,
          c: 0.488
        },
        "LNG carrier": {
          a: 2253.7,
          c: 0.474
        },
        "Ro-ro cargo ship (vehicle carrier)": {
          a: aRoroVehicle,
          c: 0.471
        },
        "Ro-ro cargo ship": {
          a: aRoro,
          c: 0.498
        },
        "Ro-ro passenger ship": {
          a: 752.16,
          c: 0.381
        },

        "Ro-ro passenger ship (HSC)": {
          a: 752.16,
          c: 0.381
        },

        "Cruise passenger ship": {
          a: 170.84,
          c: 0.214
        }
      };
      //Capacity（Act.）Dictionary
      let capacityAct = {
        "Bulk carrier": Math.min(this.vesselModel.dwt, 279000),
        "Gas carrier": this.vesselModel.dwt,
        Tanker: this.vesselModel.dwt,
        "Chemical Tanker": this.vesselModel.dwt,
        "Container ship": this.vesselModel.dwt * 0.7,
        "General Cargo ship": this.vesselModel.dwt,
        "Refrigerated cargo carrier": this.vesselModel.dwt,
        "Combination carrier": this.vesselModel.dwt,
        "LNG carrier": this.vesselModel.dwt,
        "Ro-ro cargo ship (vehicle carrier)": this.vesselModel.dwt,
        "Ro-ro cargo ship":
          this.selectModel.requirementEEDI === "Phase 2" ||
          this.selectModel.requirementEEDI === "Phase 3"
            ? Math.min(this.vesselModel.dwt, 17000)
            : this.vesselModel.dwt,
        "Ro-ro passenger ship":
          this.selectModel.requirementEEDI === "Phase 2" ||
          this.selectModel.requirementEEDI === "Phase 3"
            ? Math.min(this.vesselModel.dwt, 10000)
            : this.vesselModel.dwt,
        "Ro-ro passenger ship (HSC)":
          this.selectModel.requirementEEDI === "Phase 2" ||
          this.selectModel.requirementEEDI === "Phase 3"
            ? Math.min(this.vesselModel.dwt, 10000)
            : this.vesselModel.dwt,
        "Cruise passenger ship": this.vesselModel.gt
      };
      //Reference line
      return (
        factorDic[this.selectModel.shipType].a *
        Math.pow(
          capacityAct[this.selectModel.shipType],
          -factorDic[this.selectModel.shipType].c
        )
      );
    },
    //data3-EEXI折减系数Y
    reducFacEEXI: function() {
      let size = Number(
        this.selectModel.shipType.indexOf("Cruise") >= 0
          ? this.vesselModel.gt
          : this.vesselModel.dwt
      );
      let xDic = {
        "Bulk carrier":
          size >= 200000
            ? 15
            : size >= 20000
            ? 20
            : size >= 10000
            ? 20 - (20000 - size) / 500
            : 0,

        "Gas carrier":
          size >= 15000
            ? 30
            : size >= 10000
            ? 20
            : size >= 2000
            ? 20 - (10000 - size) / 400
            : 0,
        Tanker:
          size >= 200000
            ? 15
            : size >= 20000
            ? 20
            : size >= 4000
            ? 20 - (20000 - size) / 800
            : 0,
        "Chemical Tanker":
          size >= 200000
            ? 15
            : size >= 20000
            ? 20
            : size >= 4000
            ? 20 - (20000 - size) / 800
            : 0,
        "Container ship":
          size >= 200000
            ? 50
            : size >= 120000
            ? 45
            : size >= 80000
            ? 35
            : size >= 40000
            ? 30
            : size >= 15000
            ? 20
            : size >= 10000
            ? 20 - (15000 - size) / 250
            : 0,
        "General Cargo ship":
          size >= 15000 ? 30 : size >= 3000 ? 30 - (15000 - size) / 400 : 0,
        "Refrigerated cargo carrier":
          size >= 5000 ? 15 : size >= 3000 ? 15 - ((5000 - size) * 3) / 400 : 0,
        "Combination carrier":
          size >= 20000 ? 20 : size >= 4000 ? 20 - (20000 - size) / 800 : 0,
        "LNG carrier": size >= 10000 ? 30 : 0,
        "Ro-ro cargo ship (vehicle carrier)": size >= 10000 ? 15 : 0,
        "Ro-ro cargo ship":
          size >= 2000 ? 5 : size >= 1000 ? 5 - (2000 - size) / 200 : 0,
        "Ro-ro passenger ship":
          size >= 1000 ? 5 : size >= 250 ? 5 - (1000 - size) / 150 : 0,
        "Ro-ro passenger ship (HSC)":
          size >= 1000 ? 5 : size >= 250 ? 5 - (1000 - size) / 150 : 0,
        "Cruise Passenger ship":
          size >= 85000 ? 30 : size >= 25000 ? 30 - (85000 - size) / 2000 : 0
      };
      return xDic[this.selectModel.shipType];
    },
    //data3-EEDI折减系数Y2024
    reducFacEEDI2024: function() {
      let size = Number(
        this.selectModel.shipType.indexOf("Cruise") >= 0
          ? this.vesselModel.gt
          : this.vesselModel.dwt
      );
      let xDic = {
        "Bulk carrier":
          size >= 200000 ? 20 : size >= 10000 ? 20 - (200000 - size) / 9500 : 0,

        "Gas carrier":
          size >= 15000
            ? 30
            : size >= 10000
            ? 20
            : size >= 2000
            ? 20 - (10000 - size) / 400
            : 0,
        Tanker:
          size >= 200000 ? 20 : size >= 4000 ? 20 - (200000 - size) / 9800 : 0,
        "Chemical Tanker":
          size >= 200000 ? 20 : size >= 4000 ? 20 - (200000 - size) / 9800 : 0,
        "Container ship":
          size >= 200000
            ? 50
            : size >= 120000
            ? 45
            : size >= 80000
            ? 40
            : size >= 40000
            ? 35
            : size >= 15000
            ? 30
            : size >= 10000
            ? 30 - ((15000 - size) * 3) / 5000
            : 0,
        "General Cargo ship":
          size >= 15000 ? 30 : size >= 3000 ? 30 - (15000 - size) / 400 : 0,
        "Refrigerated cargo carrier":
          size >= 5000 ? 15 : size >= 3000 ? 15 - ((5000 - size) * 3) / 400 : 0,
        "Combination carrier":
          size >= 20000 ? 20 : size >= 4000 ? 20 - (20000 - size) / 800 : 0,
        "LNG carrier": size >= 10000 ? 30 : 0,
        "Ro-ro cargo ship (vehicle carrier)": size >= 10000 ? 15 : 0,
        "Ro-ro cargo ship":
          size >= 2000 ? 20 : size >= 1000 ? 20 - (2000 - size) / 50 : 0,
        "Ro-ro passenger ship":
          size >= 1000 ? 20 : size >= 250 ? 20 - (1000 - size) / 37.5 : 0,
        "Ro-ro passenger ship (HSC)":
          size >= 1000 ? 20 : size >= 250 ? 20 - (1000 - size) / 37.5 : 0,
        "Cruise Passenger ship":
          size >= 85000 ? 30 : size >= 25000 ? 30 - (85000 - size) / 2000 : 0
      };
      return xDic[this.selectModel.shipType];
    },
    //data3-EEDI折减系数Y2025???"Bulk carrier":size >= 20000?
    reducFacEEDI2025: function() {
      let size = Number(
        this.selectModel.shipType.indexOf("Cruise") >= 0
          ? this.vesselModel.gt
          : this.vesselModel.dwt
      );
      let xDic = {
        "Bulk carrier":
          size >= 200000
            ? 30
            : size >= 10000
            ? 30 - ((200000 - size) * 3) / 19000
            : 0,

        "Gas carrier":
          size >= 15000
            ? 30
            : size >= 10000
            ? 30
            : size >= 2000
            ? 30 - ((10000 - size) * 3) / 800
            : 0,
        Tanker:
          size >= 200000
            ? 30
            : size >= 4000
            ? 30 - ((200000 - size) * 3) / 19600
            : 0,
        "Chemical Tanker":
          size >= 200000
            ? 30
            : size >= 4000
            ? 30 - ((200000 - size) * 3) / 19600
            : 0,
        "Container ship":
          size >= 200000
            ? 50
            : size >= 120000
            ? 45
            : size >= 80000
            ? 40
            : size >= 40000
            ? 35
            : size >= 15000
            ? 30
            : size >= 10000
            ? 30 - ((15000 - size) * 3) / 5000
            : 0,
        "General Cargo ship":
          size >= 15000 ? 30 : size >= 3000 ? 30 - (15000 - size) / 400 : 0,
        "Refrigerated cargo carrier":
          size >= 5000 ? 30 : size >= 3000 ? 30 - ((5000 - size) * 3) / 200 : 0,
        "Combination carrier":
          size >= 20000 ? 30 : size >= 4000 ? 30 - (20000 - size) / 1600 : 0,
        "LNG carrier": size >= 10000 ? 30 : 0,
        "Ro-ro cargo ship (vehicle carrier)": size >= 10000 ? 30 : 0,
        "Ro-ro cargo ship":
          size >= 2000 ? 30 : size >= 1000 ? 30 - ((2000 - size) * 3) / 100 : 0,
        "Ro-ro passenger ship":
          size >= 1000 ? 30 : size >= 250 ? 30 - (1000 - size) / 25 : 0,
        "Ro-ro passenger ship (HSC)":
          size >= 1000 ? 30 : size >= 250 ? 30 - (1000 - size) / 25 : 0,
        "Cruise Passenger ship":
          size >= 85000 ? 30 : size >= 25000 ? 30 - (85000 - size) / 2000 : 0
      };
      return xDic[this.selectModel.shipType];
    },

    //EEDI-ppti
    ppti: function() {
      return (
        (this.eediModel.numberPTI * this.eediModel.ratedPowerPTI * 0.75) /
        this.eediModel.weightedAverageEfficiency
      );
    },
    //EEDI-pae
    pae: function() {
      let m = Number(this.vesselModel.mcr) + this.ppti / 0.75;
      return m < 10000 ? m * 0.05 : m * 0.025 + 250;
    },
    //EEDI-ppto
    ppto: function() {
      return this.eediModel.ratedPowerPTO * 0.75 * 0.75 < this.pae
        ? this.eediModel.ratedPowerPTO * 0.75
        : this.pae / 0.75;
    },
    //EEDI-pme
    pme: function() {
      let m =
        ((Number(this.vesselModel.mcr) - this.ppto) *
          (100 -
            this.techInflu.reduME[
              Number(this.selectModel.deliveryYear) - 2024
            ])) /
        100;
      return this.selectModel.shipType == "LNG carrier" ? m * 0.9 : m * 0.75;
    },
    //EEDI-peff
    peff: function() {
      return (
        (this.pme *
          this.techInflu.reduPeff[
            Number(this.selectModel.deliveryYear) - 2024
          ]) /
        100
      );
    },
    //EEDI-pAEeff
    pAEeff: function() {
      return (
        (this.pae *
          this.techInflu.reduAE[Number(this.selectModel.deliveryYear) - 2024]) /
        100
      );
    },
    //EEDI-cf
    cfMe1: function() {
      let f = this.decarbonModel.fuelSolu.mainFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).CfCO2;
    },
    //EEDI-cf
    cfMe2: function() {
      let f = this.decarbonModel.fuelSolu.dualFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).CfCO2;
    },
    //EEDI-cf
    cfAe1: function() {
      let f = this.decarbonModel.fuelSolu.voyageAE[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).CfCO2;
    },
    //EEDI-cf
    cfAe2: function() {
      let f = this.decarbonModel.fuelSolu.berthAE[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).CfCO2;
    },
    //EEDI-cf
    cfPilot: function() {
      let f = this.decarbonModel.fuelSolu.pilotOil[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).CfCO2;
    },

    //默认是否有影响???
    //EEDI-The total installed engine power PME and PAE
    pTotal: function() {
      return this.vesselModel.mcr * 0.75 + Number(this.pae);
    },
    //EEDI-The total dual fuel engine power PME and PAE
    pDualfuel: function() {
      return this.vesselModel.mcr * 0.75 + Number(this.pae);
    },
    //EEDI-density
    densityMe1: function() {
      let f = this.decarbonModel.fuelSolu.mainFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).Density;
    },
    //EEDI-density
    densityMe2: function() {
      let f = this.decarbonModel.fuelSolu.dualFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).Density;
    },
    //EEDI-density
    densityMGO: function() {
      let f = this.decarbonModel.fuelSolu.voyageAE[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).Density;
    },
    //EEDI-lcv
    lcvMe1: function() {
      let f = this.decarbonModel.fuelSolu.mainFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).LCV * 1000000;
    },
    //EEDI-lcv
    lcvMe2: function() {
      let f = this.decarbonModel.fuelSolu.dualFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).LCV * 1000000;
    },
    //EEDI-lcv
    lcvMGO: function() {
      let f = this.decarbonModel.fuelSolu.voyageAE[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      return this.fuelEUs.find(e => e.Fuel == f).LCV * 1000000;
    },
    //EEDI-fillingRate
    fillingRateFuel1: function() {
      return this.fillingRatios[this.selectModel.fuel1TankType];
    },
    //EEDI-fillingRate
    fillingRateFuel2: function() {
      return this.fillingRatios[this.selectModel.fuel2TankType];
    },
    //EEDI-fillingRate
    fillingRateFuel3: function() {
      return this.fillingRatios[this.selectModel.fuel3TankType];
    },

    //EEDI-The fuel availability ratio of gas fuel corrected for the power ratio of gas engines to total engines
    fdf: function() {
      return (
        ((this.pTotal / this.pDualfuel) *
          (this.fuelTanksModel.fuel1TypeCapacity *
            this.densityMe1 *
            this.lcvMe1 *
            this.fillingRateFuel1)) /
        (this.fuelTanksModel.fuel2TypeCapacity *
          this.densityMe2 *
          this.lcvMe2 *
          this.fillingRateFuel2 +
          this.fuelTanksModel.fuel3TypeCapacity *
            this.densityMGO *
            this.lcvMGO *
            this.fillingRateFuel3 +
          this.fuelTanksModel.fuel1TypeCapacity *
            this.densityMe1 *
            this.lcvMe1 *
            this.fillingRateFuel1)
      );
    },
    //EEDI-The fuel availability ratio
    gasAvailability: function() {
      return this.fdf > 0.5 ? 1 : this.fdf;
    },
    //EEDI-The fuel availability ratio
    liqAvailability: function() {
      return 1 - this.gasAvailability;
    },
    //EEDI-3.4 Capacity
    cap: function() {
      return this.selectModel.shipType === "Container ship"
        ? this.vesselModel.dwt * 0.7
        : this.selectModel.shipType.indexOf("Cruise") >= 0
        ? this.vesselModel.gt
        : this.vesselModel.dwt;
    },
    //EEDI-The factor for general cargo (fcranes)
    fcranes: function() {
      if (this.selectModel.shipType === "General Cargo ship") {
        return (
          1 +
          (0.0519 *
            this.vesselModel.swl *
            this.vesselModel.reachSWL *
            this.vesselModel.numberCranes +
            32.11) /
            this.cap
        );
      } else {
        return 1;
      }
    },
    //EEDI-Attained EEDI
    attEEDI: function() {
      let xMe =
        this.gasAvailability *
          (this.cfPilot * this.sfcModel.sfcMePilot +
            this.cfMe1 * this.sfcModel.sfcMe1) +
        this.liqAvailability * this.cfMe2 * this.sfcModel.sfcMe2;
      let xAe =
        this.gasAvailability *
          (this.sfcModel.sfcAePilot * this.cfPilot +
            this.cfAe1 * this.sfcModel.sfcAe1) +
        this.liqAvailability * this.sfcModel.sfcAe2 * this.cfAe2;
      let fj = this.fi * 1 * this.eediModel.fjroro * this.eediModel.fjgen;
      let p = 0.75 * this.ppto * this.eediModel.numberPTO;

      let att =
        (fj * this.pme * xMe +
          p * xMe +
          (this.pae - p) * xAe +
          (fj * this.eediModel.ratedPowerPTI - 1 * this.pAEeff) *
            this.cfAe1 *
            this.sfcModel.sfcAe1 -
          1 * this.peff * this.cfMe1 * this.sfcModel.sfcMe1) /
        (this.eediModel.vref *
          this.fi *
          this.fiCSR *
          this.fc *
          this.fm *
          this.cap);
      return att;
    },
    //EEDI-Reduction to the EEDI reference line
    reducEEDIRefLine: function() {
      return (this.bslnv - this.attEEDI) / this.bslnv;
    },
    //EEDI-Reduction factor
    reducFacEEDI: function() {
      return this.selectModel.deliveryYear == "2024"
        ? this.reducFacEEDI2024
        : this.reducFacEEDI2025;
    },
    //EEDI-Required EEDI
    reqEEDI: function() {
      return (1 - this.reducFacEEDI / 100) * this.bslnv;
    },
    //EEDI-Compliance
    complianceEEDI: function() {
      return Number(this.attEEDI) <= Number(this.reqEEDI);
    },

    //FuelEU-Pwind/Pprop
    pwindPprop: function() {
      return this.technicalModel.pWind / this.pme;
    },
    //FuelEU-fwind
    fwind: function() {
      return this.pwindPprop < 0.05
        ? 1
        : this.pwindPprop < 0.1
        ? 0.99
        : this.pwindPprop < 0.15
        ? 0.97
        : 0.95;
    },
    //FuelEU-M/E Fuel 1, M/E Fuel 2, AE @ voyage,AE @ berth,AE @ cargo
    fuelEUTable: function() {
      let result = {
        actualGHGIE: [],
        targetGHGIE: [],
        compliance: [],
        complianceBalance: [],
        penalty: []
      };
      let refLine = 91.7;
      let reducFac = [
        0,
        2,
        2,
        2,
        2,
        2,
        6,
        6,
        6,
        6,
        6,
        14.5,
        14.5,
        14.5,
        14.5,
        14.5,
        31,
        31,
        31,
        31,
        31,
        62,
        62,
        62,
        62,
        62,
        80
      ];
      for (
        let index = 0;
        index < this.decarbonModel.fuelSolu.mainFuel.length;
        index++
      ) {
        let fuelEUarray = [];

        // ME Fuel 1
        let fuel = this.decarbonModel.fuelSolu.mainFuel[index];
        let mass =
          (this.fuelInflu.fuel1Consumption[index] *
            this.fuelEUModel.voyageRatio) /
          100;
        fuelEUarray.push(this.getFuelEU(fuel, mass, index));
        // ME Fuel 2
        fuel = this.decarbonModel.fuelSolu.dualFuel[index];
        mass =
          (this.fuelInflu.fuel2Consumption[index] *
            this.fuelEUModel.voyageRatio) /
          100;
        fuelEUarray.push(this.getFuelEU(fuel, mass, index));
        // AE @ voyage
        fuel = this.decarbonModel.fuelSolu.voyageAE[index];
        mass =
          (this.fuelInflu.voyageAEConsumption[index] *
            this.fuelEUModel.voyageRatio) /
          100;
        fuelEUarray.push(this.getFuelEU(fuel, mass, index));
        // AE @ berth
        fuel = this.decarbonModel.fuelSolu.berthAE[index];
        mass = this.fuelInflu.berthAEConsumption[index];
        fuelEUarray.push(this.getFuelEU(fuel, mass, index));
        // AE @ cargo
        fuel = this.decarbonModel.fuelSolu.cargoAE[index];
        mass = this.fuelInflu.cargoAEConsumption[index];
        fuelEUarray.push(this.getFuelEU(fuel, mass, index));

        let res = this.columnSum(fuelEUarray);
        // result.w1.push(res[0]);
        // result.w2.push(res[1]);
        // result.t1.push(res[2]);
        // result.t2.push(res[3]);
        // result.t3.push(res[4]);
        // result.t4.push(res[5]);

        let wtT = res[1] == 0 ? 0 : res[0] / res[1];
        let ttW = res[4] == 0 ? 0 : (res[2] + res[3]) / res[4];
        let fWind =
          this.decarbonModel.techSolu
            .reduce((acc, cur) => {
              return acc + cur.tech[index];
            }, "")
            .indexOf("sail") > 0
            ? this.fwind
            : 1;
        let actualGHGIE = fWind * (wtT + ttW);
        let targetGHGIE = (refLine * (100 - reducFac[index])) / 100;
        let compliance = actualGHGIE < targetGHGIE;
        let complianceBalance = Math.abs(res[5] * (targetGHGIE - actualGHGIE));
        let penalty =
          actualGHGIE == 0
            ? 0
            : (2400 * this.fuelEUModel.eurEqualsUSD * complianceBalance) /
              actualGHGIE /
              41000;
        result.actualGHGIE.push(actualGHGIE);
        result.targetGHGIE.push(targetGHGIE);
        result.compliance.push(compliance);
        result.complianceBalance.push(complianceBalance);
        result.penalty.push(penalty);
      }
      return result;
    },

    //ETS
    etsTable: function() {
      let result = {
        co2Emission: [],
        totalCost: []
      };
      let emissionRatio = [
        40,
        70,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100
      ];
      for (
        let index = 0;
        index < this.emisCost.totalDecarbonCO2.length;
        index++
      ) {
        let emi =
          (this.emisCost.totalDecarbonCO2[index] * emissionRatio[index]) / 100;
        let cost = emi * this.fuelEUModel.carbonPriceETS;
        result.co2Emission.push(emi);
        result.totalCost.push(cost);
      }
      return result;
    },
    //Carbon Price
    carbonPriceTable: function() {
      let result = {
        co2Emission: [],
        otherCarbonTax: []
      };
      let emissionRatio = 100;
      for (
        let index = 0;
        index < this.emisCost.totalDecarbonCO2.length;
        index++
      ) {
        let emi = (this.emisCost.totalDecarbonCO2[index] * emissionRatio) / 100;
        let cost = emi * this.fuelEUModel.carbonPrice;
        result.co2Emission.push(emi);
        result.otherCarbonTax.push(cost);
      }
      return result;
    },

    //Decarbon Path-Speed reduce & Voyage Database（隐藏）
    speedReduce: function() {
      let res = [];
      for (let i = 0; i < 4; i++) {
        let dsVoyageLad =
          ((1 + this.ciiModel.voyageMargin / 100) * this.ciiModel.distance) /
          (this.targetModel.speedLaden * 48 - i * 48);
        let dsVoyageBal =
          ((1 + this.ciiModel.voyageMargin / 100) * this.ciiModel.distance) /
          (this.targetModel.speedBallast * 48 - i * 48);
        let dsNo =
          365 /
          (Number(this.ciiModel.cargoing) +
            Number(this.ciiModel.berthTime) +
            dsVoyageLad +
            dsVoyageBal);
        res.push({
          voyageLad: dsVoyageLad,
          voyageBal: dsVoyageBal,
          numRound: dsNo
        });
      }
      return res;
    },
    //Decarbon Path-Cargo Reduce efficiency
    fcReductionCargo: function() {
      let res = { "0": 0 };
      for (let i = 1; i < 4; i++) {
        let r =
          100 -
          ((this.economicModel.cargoMass * (1 - 0.1 * i) +
            Number(this.vesselModel.lwt)) *
            100 *
            1.05) /
            Number(this.ciiModel.displacementLaden);
        res[String(10 * i)] = r;
      }
      return res;
    },
    //Decarbon Path-中间计算过程(隐藏)	根据decarbonModel输入和data2确定一系列的影响合计Influence,其中的solution不用计算只是根据输入的查表扩充，然后各项按年份对应累加等。
    //Tech Influence
    techInflu: function() {
      let solu = this.decarbonModel.techSolu.map(e => {
        e.reduME = [];
        e.reduAE = [];
        e.reduPeff = [];
        e.reduCO2 = [];
        e.cargoLoss = [];
        e.tech.map(t => {
          e.reduME.push(this.techEfficiencies[t].reduME);
          e.reduAE.push(this.techEfficiencies[t].reduAE);
          e.reduPeff.push(this.techEfficiencies[t].reduPeff);
          e.reduCO2.push(this.techEfficiencies[t].reduCO2);
          e.cargoLoss.push(this.techEfficiencies[t].cargoLoss);
        });
        return e;
      });
      let res = this.dynamicColumnSum(solu);
      return res;
    },
    //Decarbon Path-Oper Influence
    operInflu: function() {
      let solu = this.decarbonModel.operSolu.map(e => {
        e.reduME = [];
        e.fcRedu = [];
        e.cargoLoss = [];
        e.speedRedu = [];
        e.oper.map(o => {
          e.reduME.push(this.operEfficiencies[o]);
          e.cargoLoss.push(this.operCargoLoss[o]);
          e.speedRedu.push(this.operSpeedRedu[o]);
          e.fcRedu.push(this.fcReductionCargo[String(this.operCargoLoss[o])]);
        });
        return e;
      });
      let res = this.dynamicColumnSum(solu);
      return res;
    },
    //Decarbon Path-Fuel Solution 根据 speedReduce,fcReductionCargo,techInflu,operInflu 对应扩充
    fuelSolution: function() {
      let res = {
        actCargoMass: [],
        speedRedu: [],
        speedLaden: [],
        speedBallast: [],
        voyageLad: [],
        voyageBal: [],
        actVoyageTimes: [],
        fcRedu: [],
        reduME: []
      };
      for (
        let index = 0;
        index < this.decarbonModel.fuelSolu.mainFuel.length;
        index++
      ) {
        let speedRedu = Math.min(this.operInflu.speedRedu[index], 3);
        res.actCargoMass.push(
          (this.economicModel.cargoMass *
            (100 -
              this.techInflu.cargoLoss[index] -
              this.operInflu.cargoLoss[index])) /
            100
        );
        res.speedRedu.push(speedRedu);
        res.speedLaden.push(Number(this.targetModel.speedLaden) - speedRedu);
        res.speedBallast.push(
          Number(this.targetModel.speedBallast) - speedRedu
        );
        res.voyageLad.push(this.speedReduce[speedRedu].voyageLad);
        res.voyageBal.push(this.speedReduce[speedRedu].voyageBal);
        res.actVoyageTimes.push(this.speedReduce[speedRedu].numRound);
        res.fcRedu.push(this.operInflu.fcRedu[index]);
        res.reduME.push(
          this.techInflu.reduME[index] + this.techInflu.reduPeff[index]
        );
      }
      return res;
    },
    // ME Fuel 1
    // ME Fuel 2
    // Pilot oil
    // AE @ voyage
    // AE @ berth
    // AE @ cargo
    //Decarbon Path-根据4. Decarbon Solutions (显示)	Fuel Solution 输入对应扩充
    fuelInflu: function() {
      let findResult = {};
      let res = {
        fuel1ActCO2: [],
        fuel1Cost: [],
        fuel1Consumption: [],
        fuel2ActCO2: [],
        fuel2Cost: [],
        fuel2Consumption: [],
        pilotOilActCO2: [],
        pilotOilCost: [],
        pilotOilConsumption: [],
        voyageAEActCO2: [],
        voyageAECost: [],
        voyageAEConsumption: [],
        berthAEActCO2: [],
        berthAECost: [],
        berthAEConsumption: [],
        cargoAEActCO2: [],
        cargoAECost: [],
        cargoAEConsumption: [],
        fuel1TankCapacity: [],
        fuel2TankCapacity: []
      };
      for (
        let index = 0;
        index < this.decarbonModel.fuelSolu.mainFuel.length;
        index++
      ) {
        // ME Fuel 1
        let mainFuel = this.decarbonModel.fuelSolu.mainFuel[index];
        findResult = this.fuelPriceModel.find(e => e.fuelType == mainFuel);
        let fuel1Price = findResult ? findResult.price[index] : 0;
        let speedRedu = this.fuelSolution.speedRedu[index];
        findResult = this.fuelInfoModel.fcMELaden.find(
          e => e.fuelType == mainFuel
        );
        let fcLaden = findResult ? findResult.fc[speedRedu] : 0;
        findResult = this.fuelInfoModel.fcMEBallast.find(
          e => e.fuelType == mainFuel
        );
        let fcBallast = findResult ? findResult.fc[speedRedu] : 0;
        let fuel1Consumption =
          (this.decarbonModel.fuelSolu.mainRatio[index] *
            (100 -
              this.fuelSolution.fcRedu[index] -
              this.fuelSolution.reduME[index]) *
            fcLaden *
            this.fuelSolution.voyageLad[index] *
            this.fuelSolution.actVoyageTimes[index]) /
            10000 +
          (this.decarbonModel.fuelSolu.mainRatio[index] *
            (100 - this.fuelSolution.reduME[index]) *
            fcBallast *
            this.fuelSolution.voyageBal[index] *
            this.fuelSolution.actVoyageTimes[index]) /
            10000;
        let fuel1Cost = fuel1Price * fuel1Consumption;
        let fuel1ActCO2 =
          this.fuelEUs.find(e => e.Fuel == mainFuel).CfCO2 * fuel1Consumption;
        let fuel1TankCapacity =
          (1.05 * fuel1Consumption * 1000) /
          this.fuelSolution.actVoyageTimes[index] /
          this.fuelEUs.find(e => e.Fuel == mainFuel).Density /
          this.fillingRateFuel1;

        // ME Fuel 2
        let dualFuel = this.decarbonModel.fuelSolu.dualFuel[index];
        findResult = this.fuelPriceModel.find(e => e.fuelType == dualFuel);
        let fuel2Price = findResult ? findResult.price[index] : 0;
        findResult = this.fuelInfoModel.fcMELaden.find(
          e => e.fuelType == dualFuel
        );
        fcLaden = findResult ? findResult.fc[speedRedu] : 0;
        findResult = this.fuelInfoModel.fcMEBallast.find(
          e => e.fuelType == dualFuel
        );
        fcBallast = findResult ? findResult.fc[speedRedu] : 0;
        let fuel2Consumption =
          (this.decarbonModel.fuelSolu.dualRatio[index] *
            (100 -
              this.fuelSolution.fcRedu[index] -
              this.fuelSolution.reduME[index]) *
            fcLaden *
            this.fuelSolution.voyageLad[index] *
            this.fuelSolution.actVoyageTimes[index]) /
            10000 +
          (this.decarbonModel.fuelSolu.dualRatio[index] *
            (100 - this.fuelSolution.reduME[index]) *
            fcBallast *
            this.fuelSolution.voyageBal[index] *
            this.fuelSolution.actVoyageTimes[index]) /
            10000;
        let fuel2Cost = fuel2Price * fuel2Consumption;
        let fuel2ActCO2 =
          this.fuelEUs.find(e => e.Fuel == dualFuel).CfCO2 * fuel2Consumption;
        let fuel2TankCapacity =
          (1.05 * fuel2Consumption * 1000) /
          this.fuelSolution.actVoyageTimes[index] /
          this.fuelEUs.find(e => e.Fuel == dualFuel).Density /
          this.fillingRateFuel2;

        // Pilot oil
        let pilotOil = this.decarbonModel.fuelSolu.pilotOil[index];
        findResult = this.fuelPriceModel.find(e => e.fuelType == pilotOil);
        let pilotOilPrice = findResult ? findResult.price[index] : 0;
        let pilotOilConsumption =
          (this.decarbonModel.fuelSolu.mainRatio[index] *
            (this.fuelSolution.voyageLad[index] +
              this.fuelSolution.voyageBal[index]) *
            this.fuelSolution.actVoyageTimes[index] *
            this.fuelInfoModel.fcPilot[0].fc) /
          100;
        let pilotOilActCO2 =
          this.fuelEUs.find(e => e.Fuel == pilotOil).CfCO2 *
          pilotOilConsumption;
        let pilotOilCost = pilotOilPrice * pilotOilConsumption;

        let reduAE = this.techInflu.reduAE[index];

        //AE @ voyage
        let voyageAE = this.decarbonModel.fuelSolu.voyageAE[index];
        findResult = this.fuelPriceModel.find(e => e.fuelType == voyageAE);
        let voyageAEPrice = findResult ? findResult.price[index] : 0;
        findResult = this.fuelInfoModel.fcAEVoyage.find(
          e => e.fuelType == voyageAE
        );
        let voyageAEConsumption =
          ((100 - reduAE) *
            (this.speedReduce[0].voyageLad + this.speedReduce[0].voyageBal) *
            this.speedReduce[0].numRound *
            (findResult ? findResult.fc : 0)) /
          100;
        let voyageAEActCO2 =
          this.fuelEUs.find(e => e.Fuel == voyageAE).CfCO2 *
          voyageAEConsumption;
        let voyageAECost = voyageAEPrice * voyageAEConsumption;

        //AE @ berth
        let berthAE = this.decarbonModel.fuelSolu.berthAE[index];
        findResult = this.fuelPriceModel.find(e => e.fuelType == berthAE);
        let berthAEPrice = findResult ? findResult.price[index] : 0;
        findResult = this.fuelInfoModel.fcAEBerth.find(
          e => e.fuelType == berthAE
        );
        let berthAEConsumption =
          ((100 - reduAE) *
            this.ciiModel.berthTime *
            this.speedReduce[0].numRound *
            (findResult ? findResult.fc : 0)) /
          100;
        let berthAEActCO2 =
          this.fuelEUs.find(e => e.Fuel == berthAE).CfCO2 * berthAEConsumption;
        let berthAECost = berthAEPrice * berthAEConsumption;

        //AE @ cargo
        let cargoAE = this.decarbonModel.fuelSolu.cargoAE[index];
        findResult = this.fuelPriceModel.find(e => e.fuelType == cargoAE);
        let cargoAEPrice = findResult ? findResult.price[index] : 0;
        findResult = this.fuelInfoModel.fcAECargo.find(
          e => e.fuelType == cargoAE
        );
        let cargoAEConsumption =
          ((100 - reduAE) *
            this.ciiModel.cargoing *
            this.speedReduce[0].numRound *
            (findResult ? findResult.fc : 0)) /
          100;
        let cargoAEActCO2 =
          this.fuelEUs.find(e => e.Fuel == cargoAE).CfCO2 * cargoAEConsumption;
        let cargoAECost = cargoAEPrice * cargoAEConsumption;

        res.fuel1ActCO2.push(fuel1ActCO2);
        res.fuel1Cost.push(fuel1Cost);
        res.fuel2ActCO2.push(fuel2ActCO2);
        res.fuel2Cost.push(fuel2Cost);
        res.pilotOilActCO2.push(pilotOilActCO2);
        res.pilotOilCost.push(pilotOilCost);
        res.voyageAEActCO2.push(voyageAEActCO2);
        res.voyageAECost.push(voyageAECost);
        res.berthAEActCO2.push(berthAEActCO2);
        res.berthAECost.push(berthAECost);
        res.cargoAEActCO2.push(cargoAEActCO2);
        res.cargoAECost.push(cargoAECost);
        res.fuel1Consumption.push(fuel1Consumption);
        res.fuel2Consumption.push(fuel2Consumption);
        res.pilotOilConsumption.push(pilotOilConsumption);
        res.voyageAEConsumption.push(voyageAEConsumption);
        res.berthAEConsumption.push(berthAEConsumption);
        res.cargoAEConsumption.push(cargoAEConsumption);
        res.fuel1TankCapacity.push(fuel1TankCapacity);
        res.fuel2TankCapacity.push(fuel2TankCapacity);
      }
      return res;
    },
    //Decarbon Path-初始方案的Consumption和CO2 emission
    origInflu: function() {
      let findResult = {};
      // ME Fuel 1
      let mainFuel = this.decarbonModel.fuelSolu.mainFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      findResult = this.fuelInfoModel.fcMELaden.find(
        e => e.fuelType == mainFuel
      );
      let fcLaden = findResult ? findResult.fc[0] : 0;
      findResult = this.fuelInfoModel.fcMEBallast.find(
        e => e.fuelType == mainFuel
      );
      let fcBallast = findResult ? findResult.fc[0] : 0;
      let fuel1Consumption =
        (this.decarbonModel.fuelSolu.mainRatio[
          Number(this.selectModel.deliveryYear) - 2024
        ] *
          (fcLaden * this.speedReduce[0].voyageLad +
            fcBallast * this.speedReduce[0].voyageBal) *
          this.speedReduce[0].numRound) /
        100;

      let fuel1ActCO2 =
        (this.fuelEUs.find(e => e.Fuel == mainFuel) || "None").CfCO2 *
        fuel1Consumption;

      // ME Fuel 2
      let dualFuel = this.decarbonModel.fuelSolu.dualFuel[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      findResult = this.fuelInfoModel.fcMELaden.find(
        e => e.fuelType == dualFuel
      );
      fcLaden = findResult ? findResult.fc[0] : 0;
      findResult = this.fuelInfoModel.fcMEBallast.find(
        e => e.fuelType == dualFuel
      );
      fcBallast = findResult ? findResult.fc[0] : 0;

      let fuel2Consumption =
        (this.decarbonModel.fuelSolu.dualRatio[
          Number(this.selectModel.deliveryYear) - 2024
        ] *
          (fcLaden * this.speedReduce[0].voyageLad +
            fcBallast * this.speedReduce[0].voyageBal) *
          this.speedReduce[0].numRound) /
        100;
      let fuel2ActCO2 =
        (this.fuelEUs.find(e => e.Fuel == dualFuel) || "None").CfCO2 *
        fuel2Consumption;

      //Pilot Oil
      let pilotOilConsumption =
        (this.decarbonModel.fuelSolu.mainRatio[
          Number(this.selectModel.deliveryYear) - 2024
        ] *
          (this.fuelInfoModel.fcPilot[0].fc * this.speedReduce[0].voyageLad +
            this.fuelInfoModel.fcPilot[0].fc * this.speedReduce[0].voyageBal) *
          this.speedReduce[0].numRound) /
        100;
      let pilotOilActCO2 = 3.206 * pilotOilConsumption;

      //AE @ voyage
      let voyageAE = this.decarbonModel.fuelSolu.voyageAE[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      findResult = this.fuelInfoModel.fcAEVoyage.find(
        e => e.fuelType == voyageAE
      );
      let fcAEVoyage = findResult ? findResult.fc : 0;
      let voyageAEConsumption =
        fcAEVoyage *
        (this.speedReduce[0].voyageLad + this.speedReduce[0].voyageBal) *
        this.speedReduce[0].numRound;
      let voyageAEActCO2 =
        (this.fuelEUs.find(e => e.Fuel == voyageAE) || "None").CfCO2 *
        voyageAEConsumption;

      //AE @ berth
      let berthAE = this.decarbonModel.fuelSolu.berthAE[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      findResult = this.fuelInfoModel.fcAEBerth.find(
        e => e.fuelType == berthAE
      );
      let fcAEBerth = findResult ? findResult.fc : 0;
      let berthAEConsumption =
        fcAEBerth * this.ciiModel.berthTime * this.speedReduce[0].numRound;
      let berthAEActCO2 =
        (this.fuelEUs.find(e => e.Fuel == berthAE) || "None").CfCO2 *
        berthAEConsumption;

      //AE @ cargo
      let cargoAE = this.decarbonModel.fuelSolu.cargoAE[
        Number(this.selectModel.deliveryYear) - 2024
      ];
      findResult = this.fuelInfoModel.fcAECargo.find(
        e => e.fuelType == cargoAE
      );
      let fcAECargo = findResult ? findResult.fc : 0;
      let cargoAEConsumption =
        fcAECargo * this.ciiModel.cargoing * this.speedReduce[0].numRound;
      let cargoAEActCO2 =
        (this.fuelEUs.find(e => e.Fuel == cargoAE) || "None").CfCO2 *
        cargoAEConsumption;

      let totalActCO2 =
        fuel1ActCO2 +
        fuel2ActCO2 +
        pilotOilActCO2 +
        voyageAEActCO2 +
        berthAEActCO2 +
        cargoAEActCO2;

      return {
        fuel1ActCO2: fuel1ActCO2,
        fuel1Consumption: fuel1Consumption,
        fuel2ActCO2: fuel2ActCO2,
        fuel2Consumption: fuel2Consumption,
        pilotOilActCO2: pilotOilActCO2,
        pilotOilConsumption: pilotOilConsumption,
        voyageAEActCO2: voyageAEActCO2,
        voyageAEConsumption: voyageAEConsumption,
        berthAEActCO2: berthAEActCO2,
        berthAEConsumption: berthAEConsumption,
        cargoAEActCO2: cargoAEActCO2,
        cargoAEConsumption: cargoAEConsumption,
        totalActCO2: totalActCO2
      };
    },
    //Decarbon Path-5. Emission and Cost（显示）计算结果即Result表格的Results
    emisCost: function() {
      let res = {
        totalOrigCO2: new Array(this.yearsLength).fill(
          this.origInflu.totalActCO2
        ),
        decarbonMECO2: [],
        decarbonAECO2: [],
        totalDecarbonCO2: [],
        totalDecarbonEfficiency: [],
        totalFuelOPEX: [],
        totalDecarbonCAPEX: []
      };
      for (let index = 0; index < this.yearsLength; index++) {
        let operPeriod = Math.max(
          this.selectOptions.deliveryYear[index] -
            this.selectModel.deliveryYear +
            1,
          0
        );
        operPeriod == 0 ? (res.totalOrigCO2[index] = 0) : 0;
        let decarbonMECO2 =
          this.fuelInflu.fuel1ActCO2[index] +
          this.fuelInflu.fuel2ActCO2[index] +
          this.fuelInflu.pilotOilActCO2[index];
        let decarbonAECO2 =
          this.fuelInflu.voyageAEActCO2[index] +
          this.fuelInflu.berthAEActCO2[index] +
          this.fuelInflu.cargoAEActCO2[index];
        let totalDecarbonCO2 =
          (1 - this.techInflu.reduCO2[index] / 100) *
          (decarbonMECO2 + decarbonAECO2);
        res.decarbonMECO2.push(decarbonMECO2);
        res.decarbonAECO2.push(decarbonAECO2);
        res.totalDecarbonCO2.push(totalDecarbonCO2);
        res.totalDecarbonEfficiency.push(
          operPeriod == 0
            ? 0
            : (1 - totalDecarbonCO2 / this.origInflu.totalActCO2) * 100
        );
        res.totalFuelOPEX.push(
          this.fuelInflu.fuel1Cost[index] +
            this.fuelInflu.fuel2Cost[index] +
            this.fuelInflu.pilotOilCost[index] +
            this.fuelInflu.voyageAECost[index] +
            this.fuelInflu.berthAECost[index] +
            this.fuelInflu.cargoAECost[index]
        );
        res.totalDecarbonCAPEX.push(
          this.techInflu.cost[index] +
            this.operInflu.cost[index] +
            this.decarbonModel.fuelSolu.cost[index]
        );
      }
      return res;
    },
    //Decarbon Path-6. Compliance （显示）各个子模块组合，即Result表格的下半部
    totalCostCarbon: function() {
      let tcc = [
        this.fuelEUTable.penalty,
        this.etsTable.totalCost,
        this.carbonPriceTable.otherCarbonTax
      ];
      return this.columnSum(tcc);
    },

    //Economic(Newbuilding)-Basic info
    economicNewbuilding: function() {
      let daysLaden = Math.ceil(
        this.ciiModel.distance / this.targetModel.speedLaden / 2 / 24
      );
      let daysBallast = Math.ceil(
        this.ciiModel.distance / this.targetModel.speedBallast / 2 / 24
      );
      let voyageDays = Math.ceil(
        (daysLaden + daysBallast) / (1 + this.ciiModel.voyageMargin / 100)
      );
      let totalBerthTime =
        Number(this.ciiModel.cargoing) + Number(this.ciiModel.berthTime);
      let numRoundtrip = Math.ceil(360 / (voyageDays + totalBerthTime));
      let totalOperatingCycle =
        Number(this.selectModel.ciiLimitYear) -
        Number(this.selectModel.deliveryYear) +
        1;
      let depreciationExpense =
        (Number(this.selfOperatingModel.newBuildingCost) -
          Number(this.selfOperatingModel.residualValue)) /
        totalOperatingCycle;
      let totalInvestment =
        Number(this.selfOperatingModel.newBuildingCost) +
        Number(this.selfOperatingModel.otherBuildingCost);
      let endYearLoan =
        Number(this.selectModel.deliveryYear) +
        Number(this.selfOperatingModel.loanTerm) -
        1;
      let totalLoanAmount =
        (totalInvestment * this.selfOperatingModel.loanValueRatio) / 100;
      let interestConstruction =
        (totalLoanAmount * this.selfOperatingModel.loanInterestRate) / 200;
      let principalInterest = -this.pmt(
        this.selfOperatingModel.loanInterestRate,
        Number(this.selfOperatingModel.loanTerm),
        totalLoanAmount + interestConstruction
      );
      let equalPrincipalRepayment =
        totalLoanAmount / this.selfOperatingModel.loanTerm;

      return {
        daysLaden,
        daysBallast,
        voyageDays,
        totalBerthTime,
        numRoundtrip,
        totalOperatingCycle,
        depreciationExpense,
        totalInvestment,
        endYearLoan,
        totalLoanAmount,
        interestConstruction,
        principalInterest,
        equalPrincipalRepayment
      };
    },
    //Economic(Newbuilding)-等额本息表
    equalInterestTable: function() {
      let res = {
        operPeriod: [],
        periodLoan: [],
        periodInterest: [],
        periodRepay: []
      };
      let nextLoan = 0;
      for (let index = 0; index < this.yearsLength; index++) {
        let operPeriod = Math.max(
          this.selectOptions.deliveryYear[index] -
            this.selectModel.deliveryYear +
            1,
          0
        );
        let periodLoan =
          operPeriod == 0 ? this.economicNewbuilding.totalLoanAmount : nextLoan;
        let periodInterest =
          operPeriod == 0
            ? this.economicNewbuilding.interestConstruction
            : (periodLoan * this.selfOperatingModel.loanInterestRate) / 100;
        let periodRepay =
          operPeriod == 0 ||
          operPeriod > Number(this.selfOperatingModel.loanTerm)
            ? 0
            : this.economicNewbuilding.principalInterest;
        nextLoan = periodLoan + periodInterest - periodRepay;
        res.operPeriod.push(operPeriod);
        res.periodLoan.push(periodLoan);
        res.periodInterest.push(periodInterest);
        res.periodRepay.push(periodRepay);
      }
      return res;
    },
    //Economic(Newbuilding)-等额本金表
    equalPaymentTable: function() {
      let res = {
        operPeriod: [],
        periodLoan: [],
        periodInterest: [],
        periodRepay: []
      };
      let nextLoan = 0;
      for (let index = 0; index < this.yearsLength; index++) {
        let operPeriod = Math.max(
          this.selectOptions.deliveryYear[index] -
            this.selectModel.deliveryYear +
            1,
          0
        );
        let periodLoan =
          operPeriod == 0 ? this.economicNewbuilding.totalLoanAmount : nextLoan;
        let periodInterest =
          operPeriod == 0
            ? this.economicNewbuilding.interestConstruction
            : (operPeriod == 1
                ? this.economicNewbuilding.interestConstruction
                : 0) +
              (periodLoan * this.selfOperatingModel.loanInterestRate) / 100;
        let periodPrincipal =
          operPeriod == 0 ||
          operPeriod > Number(this.selfOperatingModel.loanTerm)
            ? 0
            : this.economicNewbuilding.equalPrincipalRepayment;
        let periodRepay =
          operPeriod == 0 ||
          operPeriod > Number(this.selfOperatingModel.loanTerm)
            ? 0
            : periodPrincipal + periodInterest;
        nextLoan = periodLoan - periodPrincipal;
        res.operPeriod.push(operPeriod);
        res.periodLoan.push(periodLoan);
        res.periodInterest.push(periodInterest);
        res.periodRepay.push(periodRepay);
      }
      return res;
    },
    //Economic(Newbuilding)-现金流量表
    cashFlowTable: function() {
      let res = {
        operPeriod: [],
        periodIncome: [],
        residual: [],
        totalIncome: [],
        periodExpense: [],
        deprecition: [],
        fuelFee: [],
        fixOperFee: [],
        floatOperFee: [],
        decarbonFee: [],
        totalExpenseNoCarbontax: [],
        totalExpenseWithCarbontax: [],
        cashNoCarbontax: [],
        cashWithCarbontax: [],
        pvif: [],
        assetNoCarbontax: [],
        netAssetNoCarbontax: [],
        assetWithCarbontax: [],
        netAssetWithCarbontax: []
      };
      let nextAssetNoCarbontax = -this.newBuildingFinExpanse;
      let nextAssetWithCarbontax = -this.newBuildingFinExpanse;
      let paybackPeriodNoCarbontax = 0;
      let paybackPeriodWithCarbontax = 0;
      let profitYearNoCarbontax = 0;
      let profitYearWithCarbontax = 0;
      for (let index = 0; index < this.yearsLength; index++) {
        let operPeriod = Math.max(
          this.selectOptions.deliveryYear[index] -
            this.selectModel.deliveryYear +
            1,
          0
        );
        let periodIncome =
          operPeriod == 0
            ? 0
            : this.fuelSolution.actCargoMass[index] *
              this.fuelSolution.actVoyageTimes[index] *
              this.selfOperatingModel.freight *
              Math.pow(
                1 + this.selfOperatingModel.increasingRateFreight / 100,
                operPeriod - 1
              );
        let residual =
          operPeriod == this.economicNewbuilding.totalOperatingCycle
            ? Number(this.selfOperatingModel.residualValue)
            : 0;
        let totalIncome = periodIncome + residual;
        let periodExpense = this.radioModel.isEqualPrincipalPayment
          ? this.equalPaymentTable.periodRepay[index]
          : this.equalInterestTable.periodRepay[index];
        let deprecition =
          operPeriod == 0 ? 0 : this.economicNewbuilding.depreciationExpense;
        let fuelFee = operPeriod == 0 ? 0 : this.emisCost.totalFuelOPEX[index];
        let fixOperFee =
          operPeriod == 0
            ? 0
            : this.economicModel.fixedOPEX *
              Math.pow(
                1 + this.economicModel.increasingRateOPEX / 100,
                operPeriod
              );
        let floatOperFee =
          operPeriod == 0
            ? 0
            : this.fuelSolution.actVoyageTimes[index] *
              this.economicModel.floatingOPEXAverage *
              Math.pow(
                1 + this.economicModel.floatingOPEXIncreasement / 100,
                operPeriod
              );
        let decarbonFee =
          operPeriod == 0 ? 0 : this.emisCost.totalDecarbonCAPEX[index];
        let totalExpenseNoCarbontax =
          periodExpense +
          deprecition +
          fuelFee +
          fixOperFee +
          floatOperFee +
          decarbonFee;
        let totalExpenseWithCarbontax =
          totalExpenseNoCarbontax + this.totalCostCarbon[index];
        let cashNoCarbontax = totalIncome - totalExpenseNoCarbontax;
        let cashWithCarbontax = totalIncome - totalExpenseWithCarbontax;
        let pvif =
          operPeriod == 0
            ? 0
            : 1 /
              Math.pow(
                1 + this.selfOperatingModel.discountRate / 100,
                operPeriod
              );
        let assetNoCarbontax = cashNoCarbontax * pvif;
        let netAssetNoCarbontax = assetNoCarbontax + nextAssetNoCarbontax;
        nextAssetNoCarbontax = netAssetNoCarbontax;
        let assetWithCarbontax = cashWithCarbontax * pvif;
        let netAssetWithCarbontax = assetWithCarbontax + nextAssetWithCarbontax;
        nextAssetWithCarbontax = netAssetWithCarbontax;

        if (!paybackPeriodNoCarbontax && netAssetNoCarbontax > 0) {
          paybackPeriodNoCarbontax = operPeriod;
          profitYearNoCarbontax = this.selectOptions.deliveryYear[index];
        }
        if (!paybackPeriodWithCarbontax && netAssetWithCarbontax > 0) {
          paybackPeriodWithCarbontax = operPeriod;
          profitYearWithCarbontax = this.selectOptions.deliveryYear[index];
        }

        res.operPeriod.push(operPeriod);
        res.periodIncome.push(periodIncome);
        res.residual.push(residual);
        res.totalIncome.push(totalIncome);
        res.periodExpense.push(periodExpense);
        res.deprecition.push(deprecition);
        res.fuelFee.push(fuelFee);
        res.fixOperFee.push(fixOperFee);
        res.floatOperFee.push(floatOperFee);
        res.decarbonFee.push(decarbonFee);
        res.totalExpenseNoCarbontax.push(totalExpenseNoCarbontax);
        res.totalExpenseWithCarbontax.push(totalExpenseWithCarbontax);
        res.cashNoCarbontax.push(cashNoCarbontax);
        res.pvif.push(pvif);
        res.assetNoCarbontax.push(assetNoCarbontax);
        res.netAssetNoCarbontax.push(netAssetNoCarbontax);
        res.cashWithCarbontax.push(cashWithCarbontax);
        res.assetWithCarbontax.push(assetWithCarbontax);
        res.netAssetWithCarbontax.push(netAssetWithCarbontax);
      }

      res.totalAssetNoCarbontax =
        nextAssetNoCarbontax + this.newBuildingFinExpanse;
      res.totalAssetWithCarbontax =
        nextAssetWithCarbontax + this.newBuildingFinExpanse;
      res.paybackPeriodNoCarbontax = paybackPeriodNoCarbontax;
      res.paybackPeriodWithCarbontax = paybackPeriodWithCarbontax;
      res.profitYearNoCarbontax = profitYearNoCarbontax;
      res.profitYearWithCarbontax = profitYearWithCarbontax;
      res.irrNoCarbontax =
        this.irr(-this.newBuildingFinExpanse, ...res.assetNoCarbontax) / 100;
      res.irrWithCarbontax =
        this.irr(-this.newBuildingFinExpanse, ...res.assetWithCarbontax) / 100;

      return res;
    },
    //Economic(Newbuilding)-建设期金融支出
    newBuildingFinExpanse: function() {
      return (
        (this.selfOperatingModel.newBuildingCost *
          (100 - Number(this.selfOperatingModel.loanValueRatio))) /
        100
      );
    },

    //Economic(Charting)-Annual rent
    chartingAnnualRent: function() {
      return this.charteringModel.expectedDailyChartRate * 365;
    },
    //Economic(Charting)-现金流量表
    chartingTable: function() {
      let res = {
        operPeriod: [],
        periodRent: [],
        fuelFee: [],
        fixOperFee: [],
        floatOperFee: [],
        decarbonFee: [],
        totalExpenseNoRent: [],
        totalExpenseWithRent: [],
        periodIncome: [],
        periodProfit: [],
        freightBreakPoint: [],
        dailyRentalBreakPoint: []
      };
      let next = 0;
      for (let index = 0; index < this.yearsLength; index++) {
        let operPeriod = Math.max(
          this.selectOptions.deliveryYear[index] -
            this.selectModel.deliveryYear +
            1,
          0
        );
        let periodRent =
          this.chartingAnnualRent *
          Math.pow(
            1 + this.charteringModel.increasingRatioChartRate / 100,
            operPeriod
          );
        let fuelFee = operPeriod == 0 ? 0 : this.emisCost.totalFuelOPEX[index];
        let fixOperFee =
          operPeriod == 0
            ? 0
            : this.charteringModel.fixedOPEX *
              Math.pow(
                1 + this.charteringModel.increasingRateOPEX / 100,
                operPeriod
              );
        let floatOperFee =
          operPeriod == 0
            ? 0
            : this.fuelSolution.actVoyageTimes[index] *
              this.charteringModel.floatingOPEXAverage *
              Math.pow(
                1 + this.charteringModel.floatingOPEXIncreasement / 100,
                operPeriod
              );
        let decarbonFee =
          operPeriod == 0 ? 0 : this.emisCost.totalDecarbonCAPEX[index];
        let totalExpenseNoRent =
          fuelFee +
          fixOperFee +
          floatOperFee +
          decarbonFee +
          this.totalCostCarbon[index];
        let totalExpenseWithRent = totalExpenseNoRent + periodRent;
        let periodIncome =
          operPeriod == 0
            ? 0
            : this.fuelSolution.actCargoMass[index] *
              this.fuelSolution.actVoyageTimes[index] *
              this.charteringModel.Freight *
              Math.pow(
                1 + this.charteringModel.increasingRateFreight / 100,
                operPeriod
              );

        let periodProfit = periodIncome - totalExpenseWithRent;
        let freightBreakPoint =
          totalExpenseWithRent /
          (this.fuelSolution.actCargoMass[index] *
            this.fuelSolution.actVoyageTimes[index]);
        let dailyRentalBreakPoint = (periodIncome - totalExpenseNoRent) / 365;

        res.operPeriod.push(operPeriod);
        res.periodRent.push(periodRent);
        res.fuelFee.push(fuelFee);
        res.fixOperFee.push(fixOperFee);
        res.floatOperFee.push(floatOperFee);
        res.decarbonFee.push(decarbonFee);
        res.totalExpenseNoRent.push(totalExpenseNoRent);
        res.totalExpenseWithRent.push(totalExpenseWithRent);
        res.periodIncome.push(periodIncome);
        res.periodProfit.push(periodProfit);
        res.freightBreakPoint.push(freightBreakPoint);
        res.dailyRentalBreakPoint.push(dailyRentalBreakPoint);
      }

      return res;
    },
    //选项年限长度
    yearsLength: function() {
      return this.selectOptions.deliveryYear.length;
    }
  },
  methods: {
    init() {
      this.settingShow = true;
      this.updateLastSEIAS();
    },
    getData(record) {
      try {
        let lastData = this.$storage.get(record);
        for (const key in lastData) {
          if (key.indexOf("Model") >= 0) {
            this[key] = lastData[key];
          }
        }
      } catch (error) {
        console.log(error);
      }
    },
    commitChange: function(val, type) {
      this.$store.commit("setting/updateSetting", { val, type });
    },
    updateLastSEIAS: function() {
      let lastSEIASData = this.$data;
      let lastSEIASComputed = Object.keys(this.$options.computed).reduce(
        (acc, key) => {
          acc[key] = this[key];
          return acc;
        },
        {}
      );

      this.commitChange(lastSEIASData, "lastSEIASData");
      this.commitChange(lastSEIASComputed, "lastSEIASComputed");
      this.$storage.set("lastSEIASData", lastSEIASData);
      this.$storage.set("lastSEIASComputed", lastSEIASComputed);
    },
    settingClose: function() {
      this.settingShow = false;
      this.updateLastSEIAS();
    },
    //Record相关处理
    showInput: function() {
      this.inputVisible = true;
      this.$nextTick(_ => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },
    handleInputConfirm: function() {
      if (this.inputValue) {
        this.histories.push(this.inputValue);
        this.histories = Array.from(new Set(this.histories));
        this.history = this.inputValue;
        this.$storage.set(this.inputValue, this.$data);
        this.$storage.set("SEIAS_HISTORIES", this.histories);
      }
      this.inputVisible = false;
      this.inputValue = "";
    },
    loadRecord: function() {
      this.getData(this.history);
    },
    delRecord: function() {
      if (this.history) {
        let set = new Set(this.$storage.get("SEIAS_HISTORIES"));
        set.delete(this.history);
        this.histories = Array.from(set);
        this.$storage.remove(this.history);
        this.$storage.set("SEIAS_HISTORIES", this.histories);
        this.history = "";
      }
    },
    saveFile: function() {
      let name =
        (this.vesselModel.shipName ? this.vesselModel.shipName : "data") +
        ".json";
      let textOut = JSON.stringify(this.$data, null, " ");
      let blob = new Blob([textOut], {
        type: "text/plain;charset=utf-8"
      });
      saveAs(blob, name);
    },
    loadFile: function(file) {
      let reader = new FileReader();
      reader.readAsText(file, "UTF-8");
      reader.onload = e => {
        let loadResult = JSON.parse(reader.result);
        Object.keys(this.$data).forEach(key => {
          if (loadResult[key] && key.indexOf("Model") >= 0) {
            this.$data[key] = loadResult[key];
          }
        });
        this.history = "";
        this.histories = this.$storage.get("SEIAS_HISTORIES");
        this.updateLastSEIAS();
      };
      return false;
    },
    handleDelete: function(m, i) {
      if (m.length > 1) {
        m.splice(i, 1);
      }
    },
    newInputFuel: function(m, isME) {
      m.push({
        fuelType: "None",
        fc: isME ? [0, 0, 0, 0] : 0
      });
    },
    setSolu: function(v, i) {
      let x = v[i];
      for (let index = i; index < v.length; index++) {
        v[index] = x;
      }
    },
    resetFuelSoluTable: function() {
      this.decarbonModel.fuelSolu.mainFuel = new Array(this.yearsLength).fill(
        "None"
      );
      this.decarbonModel.fuelSolu.mainRatio = new Array(this.yearsLength).fill(
        0
      );
      this.decarbonModel.fuelSolu.dualFuel = new Array(this.yearsLength).fill(
        "None"
      );
      this.decarbonModel.fuelSolu.dualRatio = new Array(this.yearsLength).fill(
        0
      );
      this.decarbonModel.fuelSolu.voyageAE = new Array(this.yearsLength).fill(
        "None"
      );
      this.decarbonModel.fuelSolu.berthAE = new Array(this.yearsLength).fill(
        "None"
      );
      this.decarbonModel.fuelSolu.cargoAE = new Array(this.yearsLength).fill(
        "None"
      );
      this.decarbonModel.fuelSolu.pilotOil = new Array(this.yearsLength).fill(
        "None"
      );
      this.decarbonModel.fuelSolu.cost = new Array(this.yearsLength).fill(0);
    },
    resetCarbonPriceTable: function() {
      this.carbonPriceModel = new Array(this.yearsLength).fill(0);
    },
    resetTechSoluTable: function() {
      this.decarbonModel.techSolu = [
        {
          tech: new Array(this.yearsLength).fill("None"),
          cost: new Array(this.yearsLength).fill(0)
        }
      ];
    },
    addTechSolu: function() {
      this.decarbonModel.techSolu.push({
        tech: new Array(this.yearsLength).fill("None"),
        cost: new Array(this.yearsLength).fill(0)
      });
    },
    resetOperSoluTable: function() {
      this.decarbonModel.operSolu = [
        {
          oper: new Array(this.yearsLength).fill("None"),
          cost: new Array(this.yearsLength).fill(0)
        }
      ];
    },
    addOperSolu: function() {
      this.decarbonModel.operSolu.push({
        oper: new Array(this.yearsLength).fill("None"),
        cost: new Array(this.yearsLength).fill(0)
      });
    },
    resetFuelPriceTable: function() {
      this.fuelPriceModel = [
        { fuelType: "None", price: new Array(this.yearsLength).fill(0) }
      ];
    },
    addFuelPrice: function() {
      this.fuelPriceModel.push({
        fuelType: "None",
        price: new Array(this.yearsLength).fill(0)
      });
    },
    columnSum: function(matrix) {
      return matrix[0].map((_, i) =>
        matrix.reduce((sum, row) => sum + Number(row[i]), 0)
      );
    },
    dynamicColumnSum: function(solu) {
      let res = solu.reduce((acc, obj) => {
        Object.keys(obj).forEach(key => {
          if (!acc[key]) {
            acc[key] = new Array(obj[key].length).fill(0);
          }
          acc[key] = acc[key].map((sum, idx) => sum + Number(obj[key][idx]));
        });
        return acc;
      }, {});
      return res;
    },
    getFuelEU: function(fuel, mass, index) {
      let result = [0, 0, 0, 0, 0, 0];
      let fuelEU = this.fuelEUs.find(e => e.Fuel == fuel); //查找data2的fuelEU对象{Fuel LCV	 CO2eqWtT	CfCO2	CfCH4	CfN2O	Cslip}
      if (fuelEU) {
        let rwd =
          fuel == "None"
            ? 0
            : fuelEU.FuelType == "e-fuel" && index < 10
            ? 2
            : 1;
        let w1 = mass * fuelEU.LCV * fuelEU.CO2eqWtT;
        let w2 = mass * fuelEU.LCV * rwd;
        let co2eqTtW = fuelEU.CfCO2 + fuelEU.CfCH4 * 25 + fuelEU.CfN2O * 298;
        let co2eqTtWSlip = fuelEU.CfCH4 * 25;
        let t1 = mass * co2eqTtW * (1 - fuelEU.Cslip * 0.01);
        let t2 = mass * co2eqTtWSlip * fuelEU.Cslip * 0.01;
        let t3 = w2;
        let t4 = mass * fuelEU.LCV * 1000000;
        result = [w1, w2, t1, t2, t3, t4];
      }
      return result;
    },
    pmt: function(rate, periods, pv) {
      let r = rate / 100;
      let pmt = (-pv * r) / (1 - Math.pow(1 + r, -periods));
      return pmt;
    },
    // seekZero seeks the zero point of the function fn(x), accurate to within x \pm 0.01. fn(x) must be decreasing with x.
    seekZero: function(fn) {
      var x = 1;
      while (fn(x) > 0) {
        x += 1;
      }
      while (fn(x) < 0) {
        x -= 0.01;
      }
      return x + 0.01;
    },
    // Internal Rate of Return (IRR)
    irr: function(cfs) {
      var args = arguments;
      var numberOfTries = 1;
      // Cash flow values must contain at least one positive value and one negative value
      var positive, negative;
      Array.prototype.slice.call(args).forEach(function(value) {
        if (value > 0) positive = true;
        if (value < 0) negative = true;
      });
      if (!positive || !negative) return null;
      // throw new Error(
      //   "IRR requires at least one positive value and one negative value"
      // );
      function npv(rate) {
        numberOfTries++;
        if (numberOfTries > 1000) {
          throw new Error("IRR can't find a result");
        }
        var rrate = 1 + rate / 100;
        var npv = args[0];
        for (var i = 1; i < args.length; i++) {
          npv += args[i] / Math.pow(rrate, i);
        }
        return npv;
      }
      return Math.round(this.seekZero(npv) * 100) / 100;
    },
    clearStorage: function() {
      this.$storage.clear();
      location.reload();
    }
  },
  created() {
    this.getData("lastSEIASData");
    if (this.decarbonModel.fuelSolu.mainFuel.length == 0) {
      this.resetFuelSoluTable();
    }
    this.histories = Object.assign([], this.$storage.get("SEIAS_HISTORIES"));
    this.$store.commit("setting/initSetting");
    (this.sbtxradio = this.$store.state.setting.sbtxSwiper),
      (this.ssyjradio = this.$store.state.setting.ssyjSwiper),
      (this.isScaleradio = this.$store.state.setting.isScale);
  },
  mounted() {
    document.body.appendChild(this.$el);
  },
  beforeDestroy() {},
  destroyed() {
    if (this.$el && this.$el.parentNode) {
      this.$el.parentNode.removeChild(this.$el);
    }
  }
};
</script>

<style lang="scss" scoped></style>
